This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to stop gcc padding structs???



>I'm again fighting with gcc trying (and failing) to get it to
>stop putting padding bytes into structs.  Have any eCosians
>figured out how to prevent gcc from padding structs?

I have had the same type of problem trying to get it working on a 
structure-by-structure basis and I am running with the entire OS compiled 
with packed structures.

Warning!!!! am not sure if it is caused by this act, but I have run into 
another problem since doing this, and it caused much head-scratching. It 
seems that if I pass a parameter by reference, and then pass that reference 
down into another function, the lower function gets a pointer to garbage 
rather than a pointer to the real value. So it can't properly work with or 
update the parameter.

The solution to this is to create a local variable in the upper function, 
and pass THAT down to the lower function, and copy the value across 
afterwards. But it's very annoying.

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]