From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <1959055281.1911186.1412697516384.JavaMail.ngmail@webmail14.arcor-online.net> References: <1341360045.898340.1412695492957.JavaMail.ngmail@webmail12.arcor-online.net> <1959055281.1911186.1412697516384.JavaMail.ngmail@webmail14.arcor-online.net> From: =?UTF-8?Q?=C3=81lvaro_Jurado?= Date: Tue, 7 Oct 2014 19:27:42 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d04388e697969410504d88542 Subject: Re: [9fans] C question on struct Biobuf in bio.h Topicbox-Message-UUID: 19113320-ead9-11e9-9d60-3106f5b1d025 --f46d04388e697969410504d88542 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm using gcc to compile plan9 code from some time (4.7/4.8) and that option are masking real behaviour. Do not warns or put out an error about "anonymous structs", but you will have a conflict if to structs in the same source are including a, for example, "Lock;" element, and ld could not assign right the values if declarations are not specified ansi style (variable initialization it's made by ld, not by the compiler): you will get some dragons in some cases. Look at LP49 source code and you will see that authors used your second way= . =C3=81lvaro Jurado Cuevas colmenar.biz.tm 2014-10-07 17:58 GMT+02:00 Carsten Kunze : > > Otherwise, your change is fine, but "hdr" would probably be > > a better name than "Biobufhdr". Also, don't forget to update > > your code to use b->hdr.fid instead of b->fid, and so on. > > Thanks for all answers! > > (They also helped to find a short documentation in /sys/doc/compiler) > > Carsten > > --f46d04388e697969410504d88542 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm using gcc to compile plan9 code from some time (4.= 7/4.8) and that option are masking real behaviour. Do not warns or put out = an error about "anonymous structs", but you will have a conflict = if to structs in the same source are including a, for example, "Lock;&= quot; element, and ld could not assign right the values if declarations are= not specified ansi style (variable initialization it's made by ld, not= by the compiler): you will get some dragons in some cases.
Look at LP4= 9 source code and you will see that authors used your second way.

=C3=81= lvaro Jurado Cuevas

2014-10-07 17:58 GMT+02:00 Carsten Kunze <carsten.kunze@arcor.de>:
> Otherwise, your change is fine, but "hdr"= would probably be
> a better name than "Biobufhdr". Also, don't forget to up= date
> your code to use b->hdr.fid instead of b->fid, and so on.

Thanks for all answers!

(They also helped to find a short documentation in /sys/doc/compiler)

=C2=A0 =C2=A0Carsten


--f46d04388e697969410504d88542--