> Thanks, This is a workable solution.
> But the issue is I've some 100+ structures. So, writing
> a if or case is going to be difficult.
> 
> b) Yes. I want to pass a structure name. ie, make sizeof
> accept a variable. 
You can't do this in C, but you might be able to achieve something
similar using gdb, if performance isn't important.  If your
application is compiled with debug symbols, you can go ``inspect
sizeof(struct my_struct)'' from the gdb prompt, and get the number
you're looking for; you may be able to automate this.

If your application doesn't have debug symbols, then the information
you need isn't preserved by the compiler, so you're stuffed.

Steven.

Attachment: signature.asc
Description: Digital signature

Reply via email to