Re: [9fans] C question on struct Biobuf in bio.h

2014-10-08 Thread Charles Forsyth
On 7 October 2014 18:27, Álvaro Jurado wrote: > > , 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. Initialisations of externals is done by the comp

Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Álvaro Jurado
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 r

Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread 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

Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread David du Colombier
> in bio.h there is a > > struct Biobuf > { > Biobufhdr; > uchar b[Bungetsize+Bsize]; > }; > > where Biobufhdr is declared as > > typedef struct Biobufhdr Biobufhdr; This is an unnamed structure. Recent versions of GCC should be able to handle them when setting the -fplan

Re: [9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Bence Fábián
hi, no, it is an anonym field. and it is used in a way that is not part of ansi c. there is an extension in newer versions of gcc which supports it, but if you wan't to port plan 9 c to unix you can use the libs from plan9port. that's far more easier. bence 2014-10-07 17:24 GMT+02:00 Carsten

[9fans] C question on struct Biobuf in bio.h

2014-10-07 Thread Carsten Kunze
Hello, in bio.h there is a struct Biobuf { Biobufhdr; uchar b[Bungetsize+Bsize]; }; where Biobufhdr is declared as typedef struct Biobufhdr Biobufhdr; To make it compile with gcc under UNIX I changed the struct to struct Biobuf { Biobufhdr Biobufhdr;