On (29 Oct 97) Jamie Kowinsky wrote to All...
JK> long studentsize;
JK> StudentType temp;
JK> studentsize = sizeof(temp);
JK> however i recently found out that I can simply do studentsize =
JK> sizeof(StudentType); Well at least in Turbo C++ 4.5 one can, I don't
JK> know if this is standard.
Yes, it is.
JK> Now my question is, does the compiler treat "sizeof(StructName);" as a
JK> constant? During compile time will it lookup the size of the stuct
JK> and simply use that number instead of calculating the size of the
JK> stucture each time?
With nearly all compilers it's handled entirely at compile time. I
believe Metaware supports some extensions so under some circumstances
it's done at run-time, but this is _quite_ unusual.
Later,
Jerry.
--- PPoint 2.02
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|