I'm working with Dan's bootVM to get to run on Windows, and have been thinking about the use of -fpack-struct vs #pragm pack() vs just not packing and writing code that is a little slower, and a little more verbose, but seemingly more robust and maintainable due to less information about context needed to avoid surprises.

I've reconfirmed that packing structs is deadly when you want to call into standard libs

struct stat foo;

stat("foo.txt", &foo);

does some bizarre things :)

So how do people deal with this these days? I know fashions change, and I haven't done C in anger for > 6 years... (I still have the shakes when looking at it - I'm past the screaming stage...)

geir

hi,

  We should compile the code using the same C flags that the libc uses.

Parameter marshalling is another source of problems: if we want to optimize our C code for speed (parameters passed through registers), we will have to recompile the libc.

Enrico

Reply via email to