Thread: is this infinite recursion?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Define "does not work"...

    --
    Mats

  2. #2
    Registered User msp's Avatar
    Join Date
    Jul 2007
    Location
    in
    Posts
    31
    Quote Originally Posted by matsp View Post
    Define "does not work"...

    --
    Mats
    Even this did not fell into an infinite recursion!

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    As described by MacGyver, the problem is that the compiler believes that this function is a "no-operation" and eliminates the call to it. If you make the function "do something", such as increment argc, print something, return random() or something else that cause the function to actually have at least some side-effect, then you will be able to do it.

    Or try with "no optimization" in the compiler, that should make the compiler not remove the call - verify by looking at the assembler output from the compiler.

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  2. convert Recursion to linear can it be done
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2008, 02:58 AM
  3. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM
  4. stack and recursion help needed!
    By LouB in forum C++ Programming
    Replies: 3
    Last Post: 07-01-2002, 02:19 PM
  5. To Recur(sion) or to Iterate?That is the question
    By jasrajva in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 09:24 AM