[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Programming question: sizeof struct?



Hi there,

The upstream maintainer of one of my packages is having problems
with his code. I thought it would be nice to use the debian mailing
lists, to see if we can an answer on this. I will forward any solution
to him.

----------------------------------------------------------------------
The reason why I have not released LogConv 1.54 for Linux is that I am
having problems with packed structures that is causing some file formats
to not be handled properly.  Even though I specify -fpack_struct the
generated code does not appear to actually do this.  Structure fields
are
offset and the return from sizeof() returns a value that is not valid.
For instance, if the structure were:

struct foo {
    char text[3];
    int  num;
};

sizeof would return 6 and not 5.  So it's obvious that the compiler is
placing a pad byte between text and num to align num.  I want it to
stop!
-----------------------------------------------------------------------

Thanks for your attention.

Joop
-- 

 Joop Stakenborg PA4TU, ex-PA3ABA <pa3aba@debian.org>
 Linux Hamradio Applications and Utilities Homepage
 http://www.casema.net/~aba


Reply to: