Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. can recursive functions be inline functions?

can recursive functions be inline functions?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    namaskaaram
    wrote on last edited by
    #1

    can recursive functions be inline functions?

    R S 2 Replies Last reply
    0
    • N namaskaaram

      can recursive functions be inline functions?

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      The compiler might not know the number of recursions that can happen during compile time. Neither can it decide it by itself. That information will be available at runtime only. So the compiler will *not* be able to generate the inline code at compile time. Rajesh R. Subramanian You have an apple and me too. We exchange those and We have an apple each. You have an idea and me too. We exchange those and We have two ideas each.

      N 1 Reply Last reply
      0
      • N namaskaaram

        can recursive functions be inline functions?

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        inline is only a suggestion to the compiler. There are things you can do in code which will result in a "vanilla" function even though it's marked inline, such as taking its address. Another common one is recursive functions. Steve

        1 Reply Last reply
        0
        • R Rajesh R Subramanian

          The compiler might not know the number of recursions that can happen during compile time. Neither can it decide it by itself. That information will be available at runtime only. So the compiler will *not* be able to generate the inline code at compile time. Rajesh R. Subramanian You have an apple and me too. We exchange those and We have an apple each. You have an idea and me too. We exchange those and We have two ideas each.

          N Offline
          N Offline
          namaskaaram
          wrote on last edited by
          #4

          yeah!.....exactly what i had in mind.....but if somehow if it could,it did be more efficient!.....it seemz recursive functions are slightly slower than functions that are iterated..... thatz when i thought of inline..... anywayz!.....thanx for the reply cheerz!

          R 1 Reply Last reply
          0
          • N namaskaaram

            yeah!.....exactly what i had in mind.....but if somehow if it could,it did be more efficient!.....it seemz recursive functions are slightly slower than functions that are iterated..... thatz when i thought of inline..... anywayz!.....thanx for the reply cheerz!

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            You're welcome Rajesh R. Subramanian You have an apple and me too. We exchange those and We have an apple each. You have an idea and me too. We exchange those and We have two ideas each.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups