jvkelley@watcgl.waterloo.edu (Jeff Kelley) (06/29/88)
Taking the 'sizeof' an undefined structure returns a 0 rather than
generating an error.
e.g.
main(){
printf("sizeof(struct Undef)=%d",sizeof(struct Undef));
}
will print 'sizeof(struct Undef)=0'.
This one bit me when I forgot to #include a header file, and my only
use of the structure in the file was through a 'sizeof' reference.
Debugging devices is hard enough without debugging the compiler too. :-(
Tip to Lattice C users: If you've been frustrated by 'omd's inability
to disassemble load files, there is a partial way around it. When you
link all your object files together, use the 'PRELINK' option to 'blink'.
You then get something very similar to a load file, but 'omd' will grok it.
--
Jeff Kelley Graphics Lab, Dept. of Computer Science, University of Waterloo
uunet!watmath!watcgl!jvkelley tel: (519) 578-4514
"Remember, this is not a competition, only an exhibition. Please, no wagering."
- David Letterman
mwm@eris.berkeley.edu (Mike (I'm in love with my car) Meyer) (07/06/88)
In article <5016@watcgl.waterloo.edu> jvkelley@watcgl.waterloo.edu (Jeff Kelley) writes:
<Taking the 'sizeof' an undefined structure returns a 0 rather than
<generating an error.
That's not a bug, that's a feature.
At least, Lattice thinks it is. That's why the gave you the "-ct"
switch to lc. It causes such things to be reported as a warning (#
61).
Of course, they make up for it by considering several
common-in-machine-generated-code but nonsensical cases (like an empty
file) to be an error instead of a warning (gnashing of teeth in the
background).
<mike
--
Kiss me with your mouth. Mike Meyer
Your love is better than wine. mwm@berkeley.edu
But wine is all I have. ucbvax!mwm
Will your love ever be mine? mwm@ucbjade.BITNET