TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JAMIE KOWINSKY
from: KURT KUZBA
date: 1997-11-01 04:59:00
subject: sizeof() question

JK>   Now my question is, does the compiler treat
JK>   "sizeof(StructName);" as a constant?  During compile time
JK>   will it look up the size of the stuct and simply use that
JK>   number instead of calculating the size of the stucture
JK>   each time?
   Why don't you write a little program to test the time it
   takes to find sizeof(int) and compare the results to
   finding sizeof(MyStruct)?
   It should add sizeof(MyStruct) to a table of values and the
   lookup time should be equal if it does not calculate it on
   every call.
   My tests seem to indicate that they take the same ammount
   of time.
> ] I'm so relieved...  My IQ test came back negative...........
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.