Re: Bug#302181: need help on #271678 (sizefo struct?)
Hello Russ,
thanks for your help!!!
Ok, I could inline the definition and be happy or go with the sarge version.
In the past i tried to do nasty ifdef tricks to be portable, but I found
out that inlining those declarations is easier and more robust. In case of
networking the layout cant change, anyway.
Greetings
Bernd
On Sun, May 15, 2005 at 07:44:25PM -0700, Russ Allbery wrote:
> 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/>
>
>
--
(OO) -- Bernd_Eckenfels@Mörscher_Strasse_8.76185Karlsruhe.de --
( .. ) ecki@{inka.de,linux.de,debian.org} http://www.eckes.org/
o--o 1024D/E383CD7E eckes@IRCNet v:+497211603874 f:+49721151516129
(O____O) When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl!
Reply to: