J
Jeff P. Syverson
Can anyone tell me the best way to find out the size of a struct, without
using the sizeof function? I'm currently thinking of:
struct foo s[2];
int size_of_foo = (char *)&s[1] - (char *)s;
but is there a more elegant way (e.g. requiring no memory).
Thanks in advance!
-Jeff
******************************************************************************
* *
* JEFF P. SYVERSON, PHD *
* Senior Systems Engineer *
* *
* CITRIC SOLUTIONS INC. -- 2495 SUNRISE BLVD -- RANCHO CORDOVA -- CA *
* *
******************************************************************************
This email and any file attachments(s) are confidential, may be legally
privileged, and are intended solely for use by the identified recipient(s). If
you received the email in error, please notify the sender and delete the
message and any copies completely from your computer. Dissemination,
distribution, or copying of this communication, in whole or in part, by any
unintended or unauthorized recipient is prohibited and may subject you to
liability under 18 U.S.C. sec. 2511. Citric Solutions, Inc. assumes no
liability and makes no warranties or representations that the email or any
file attachments are totally secure and/or virus free. The recipient is
advised to check for viruses prior to opening any file attached to the email.
Statements contained in the email or any file attachment may not be authorized
or endorsed by Citric Solutions, Inc. Citric Solutions, Inc. accepts no
liability, whether in contract, tort, or equity, for any unauthorized
statement or offer of contract communicated in the email or any file attached
by the sender.
using the sizeof function? I'm currently thinking of:
struct foo s[2];
int size_of_foo = (char *)&s[1] - (char *)s;
but is there a more elegant way (e.g. requiring no memory).
Thanks in advance!
-Jeff
******************************************************************************
* *
* JEFF P. SYVERSON, PHD *
* Senior Systems Engineer *
* *
* CITRIC SOLUTIONS INC. -- 2495 SUNRISE BLVD -- RANCHO CORDOVA -- CA *
* *
******************************************************************************
This email and any file attachments(s) are confidential, may be legally
privileged, and are intended solely for use by the identified recipient(s). If
you received the email in error, please notify the sender and delete the
message and any copies completely from your computer. Dissemination,
distribution, or copying of this communication, in whole or in part, by any
unintended or unauthorized recipient is prohibited and may subject you to
liability under 18 U.S.C. sec. 2511. Citric Solutions, Inc. assumes no
liability and makes no warranties or representations that the email or any
file attachments are totally secure and/or virus free. The recipient is
advised to check for viruses prior to opening any file attached to the email.
Statements contained in the email or any file attachment may not be authorized
or endorsed by Citric Solutions, Inc. Citric Solutions, Inc. accepts no
liability, whether in contract, tort, or equity, for any unauthorized
statement or offer of contract communicated in the email or any file attached
by the sender.