Is sizeof similar to a function in that it is 'called' each time I place it in my code (meaning will any calculations take place at every sizeof), or will some sort of constant be placed in the code instead?
This is a discussion on quick question about sizeof operator within the C++ Programming forums, part of the General Programming Boards category; Is sizeof similar to a function in that it is 'called' each time I place it in my code (meaning ...
Is sizeof similar to a function in that it is 'called' each time I place it in my code (meaning will any calculations take place at every sizeof), or will some sort of constant be placed in the code instead?
Because sizeof is not a function but instead a compile time operator the answer to your question is that the compiler will replace the sizeof with a constant.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi