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. Faq in C :

Faq in C :

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 5 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.
  • M Offline
    M Offline
    madhu_v
    wrote on last edited by
    #1

    Hi, When will a register variable would be created in "C"?(during compile or run time)

    S A R 3 Replies Last reply
    0
    • M madhu_v

      Hi, When will a register variable would be created in "C"?(during compile or run time)

      S Offline
      S Offline
      Selvam R
      wrote on last edited by
      #2

      register is only hint to compiler! The compiler may ignore this. So, it will created during compile time.

      Thanks and Regards, Selvam, http://www.wincpp.com

      1 Reply Last reply
      0
      • M madhu_v

        Hi, When will a register variable would be created in "C"?(during compile or run time)

        A Offline
        A Offline
        Adam Roderick J
        wrote on last edited by
        #3

        Yes compilation time itself. Actually register storage class specifier indicates to the compiler that the object should be stored in a machine register. Which makes it extremely faster than in physical memory. But with some restrictions For more info just refer the below link :- http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/regdef.htm[^]

        Величие не Бога может быть недооценена.

        M 1 Reply Last reply
        0
        • A Adam Roderick J

          Yes compilation time itself. Actually register storage class specifier indicates to the compiler that the object should be stored in a machine register. Which makes it extremely faster than in physical memory. But with some restrictions For more info just refer the below link :- http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/regdef.htm[^]

          Величие не Бога может быть недооценена.

          M Offline
          M Offline
          madhu_v
          wrote on last edited by
          #4

          Thanks in advance.. How do the compiler know the availability of free registers at compile time? It's practically soundless, when a stack frame is created at runtime how could the register variable is defined at compile time?

          C 1 Reply Last reply
          0
          • M madhu_v

            Thanks in advance.. How do the compiler know the availability of free registers at compile time? It's practically soundless, when a stack frame is created at runtime how could the register variable is defined at compile time?

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            madhu_v wrote:

            How do the compiler know the availability of free registers at compile time?

            Well, I believe that allocating registers is one of the task of a compiler... :rolleyes: Anyway, the register keyword is just an hint for the compiler. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            A 1 Reply Last reply
            0
            • M madhu_v

              Hi, When will a register variable would be created in "C"?(during compile or run time)

              R Offline
              R Offline
              Rane
              wrote on last edited by
              #6

              During Compile time... Regards, Rane

              M 1 Reply Last reply
              0
              • R Rane

                During Compile time... Regards, Rane

                M Offline
                M Offline
                madhu_v
                wrote on last edited by
                #7

                Thank you for all the reply....

                1 Reply Last reply
                0
                • C CPallini

                  madhu_v wrote:

                  How do the compiler know the availability of free registers at compile time?

                  Well, I believe that allocating registers is one of the task of a compiler... :rolleyes: Anyway, the register keyword is just an hint for the compiler. :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  A Offline
                  A Offline
                  Adam Roderick J
                  wrote on last edited by
                  #8

                  Yes exactly :)

                  Величие не Бога может быть недооценена.

                  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