harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Lydick" <dlyd...@earthlink.net>
Subject Re: opinions on structure packing in C?
Date Fri, 07 Oct 2005 16:16:59 GMT

It seems that not all versions of 'libc' are compiled
with the same flags.  Furthermore, the edition that I
am using (GCC 3.3.3 on Solaris 9) apparently does not
use all the same flags all the way around.  I am
suspicious of this because I was able to compile
everything but code that used fprintf(3) and sprintf(3)
with -fpack-struct, yet had to compile code that
invoked those library(3) calls _without_ it!  I am
really interested to see what other permutations of
this problem we find, and what solutions might present

Probably making _absolutely_ sure that this problem
goes away with a recompile of 'libc' is a very good
idea, whether considering optimization or not.  But
optimization itself is a long way down the road on
the code I put together.  I still have one module
that I'm finishing up, which Geir is aware of.  But
let's keep this 'libc' question on the table because
surely other people are going to run into it when
they look at the code and try compiling.

Dan Lydick

> [Original Message]
> From: Enrico Migliore <enrico.migliore@fatti.com>
> To: <harmony-dev@incubator.apache.org>
 > Date: 10/7/05 2:12:05 AM
> Subject: Re: opinions on structure packing in C?
> > 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

View raw message