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

Re: need help on #271678 (sizefo struct?)

Bernd Eckenfels <be-mail2005@lina.inka.de> writes:

> Hello,

> On Sat, May 14, 2005 at 06:36:21PM +0200, Cesare Tensi wrote:
>> The bugs #271678 (also #302181) is fixed in -10, so you can close it.
>> (X25 Compiled problem).

> It is not fixed, the code still reads sizeof(struct x25_address) and I
> think this is correct, since it compiles with recent GCC. I tagged this
> needhelp, cause I dont eat C language spec for dinner, but i am quite
> sure the bug report is invalid.

sizeof(x25_address) returns the size of the typedef or variable by the
name x25_address.  This isn't the same thing as the struct definition
named x25_address; in fact, they may be completely unrelated.

This is a woody vs. sarge difference.  On sarge, linux/x25.h says:

struct x25_address {
        char x25_addr[16];

so the current code, with sizeof(struct x25_address) is correct and
changing it would actually break the code.  On woody, linux/x25.h says:

typedef struct {
        char            x25_addr[16];
} x25_address;

which means that sizeof(x25_address) is correct and the current code won't
compile (because nothing ever creates a struct x25_address, just an
anonymous struct that is typedef'd to x25_address).  This is an
incompatible change in the kernel headers, and there isn't any way for the
code to compile on both systems without some additional portability work.

If you don't care about supporting woody, the current code is correct.

Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Reply to: