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. internal working of "sizeof()" operator

internal working of "sizeof()" operator

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • S Offline
    S Offline
    Sachinpatole
    wrote on last edited by
    #1

    Hi, how does "sizeof" operator works internally? Thanks -Sachin

    R D 2 Replies Last reply
    0
    • S Sachinpatole

      Hi, how does "sizeof" operator works internally? Thanks -Sachin

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

      Did you try a simple Google search[^]?


      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.

      S 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        Did you try a simple Google search[^]?


        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.

        S Offline
        S Offline
        Sachinpatole
        wrote on last edited by
        #3

        I tried that also, but didn't get any solution. -Sachin

        N H 2 Replies Last reply
        0
        • S Sachinpatole

          I tried that also, but didn't get any solution. -Sachin

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          Sachinpatole wrote:

          I tried that also, but didn't get any solution.

          You are lying... :)

          - NS -

          1 Reply Last reply
          0
          • S Sachinpatole

            I tried that also, but didn't get any solution. -Sachin

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            Sachinpatole wrote:

            I tried that also, but didn't get any solution.

            So google is not your friend.;)

            1 Reply Last reply
            0
            • S Sachinpatole

              Hi, how does "sizeof" operator works internally? Thanks -Sachin

              D Offline
              D Offline
              DQNOK
              wrote on last edited by
              #6

              The compiler "knows" the sizes of all types that are native, or have been declared up to that point. It merely substitutes an integer constant in place of the sizeof expression at compile-time. Unless you're talking about reflection or RTTI (run-time type identification), all the size information is known at compile time, so there is no run-time involvement; just a simple substitution. Much like using a #define or a const. Hope this helps. David

              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