From: H. H. <hen...@gm...> - 2008-08-24 16:14:46
|
Yes. I hope we have reached a some sort of consensus that struct-unions are the way to go. For now, I will define the math types with anonymous unions and structures. We can use compiler magic to suppress warnings if need be. typedef struct { union { GLfloat data[2]; struct { GLfloat x, y; }; }; } GLMvec2f; On Sun, Aug 24, 2008 at 5:16 PM, Stefanos A. <sta...@gm...> wrote: > > > On Sun, Aug 24, 2008 at 6:31 AM, Branan Riley <br...@gm...> wrote: > > Could be a different version of MSVC giving different > > warnings. > > Actually no, just stricter warnings (warning level 4, where the default > is 3). GCC doesn't produce any warnings even with -Wall. > > However, please note that the anonymous union is *not* valid C89 (fails > to compile with "gcc -ansi"). I'm not saying this is a problem (//-style > comments aren't valid C89 either), just something to keep in mind and > document. > > // Not valid C89 > union > { > float data[2]; > struct { float x, y; }; > }; > > /* Valid C89 */ > union foo_union > { > float data[2]; > struct bar_struct { float x, y; } bar; > } foo; > > Anyone knows if these have been standardized in C99? > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Glsdk-devel mailing list > Gls...@li... > https://lists.sourceforge.net/lists/listinfo/glsdk-devel > -- Henri 'henux' Häkkinen |
From: Branan R. <br...@gm...> - 2008-08-24 17:06:37
|
Sounds good. Having names for the internal types in there makes it harder to read, IMHO. On Sun, Aug 24, 2008 at 9:14 AM, Henri Häkkinen <hen...@gm...> wrote: > Yes. I hope we have reached a some sort of consensus that struct-unions are > the way to go. For now, I will define the math types with anonymous unions > and structures. We can use compiler magic to suppress warnings if need be. > > typedef struct { > union { > GLfloat data[2]; > struct { > GLfloat x, y; > }; > }; > } GLMvec2f; > > > On Sun, Aug 24, 2008 at 5:16 PM, Stefanos A. <sta...@gm...> wrote: >> >> >> On Sun, Aug 24, 2008 at 6:31 AM, Branan Riley <br...@gm...> wrote: >> > Could be a different version of MSVC giving different >> > warnings. >> >> Actually no, just stricter warnings (warning level 4, where the default >> is 3). GCC doesn't produce any warnings even with -Wall. >> >> However, please note that the anonymous union is *not* valid C89 (fails >> to compile with "gcc -ansi"). I'm not saying this is a problem (//-style >> comments aren't valid C89 either), just something to keep in mind and >> document. >> >> // Not valid C89 >> union >> { >> float data[2]; >> struct { float x, y; }; >> }; >> >> /* Valid C89 */ >> union foo_union >> { >> float data[2]; >> struct bar_struct { float x, y; } bar; >> } foo; >> >> Anyone knows if these have been standardized in C99? >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Glsdk-devel mailing list >> Gls...@li... >> https://lists.sourceforge.net/lists/listinfo/glsdk-devel > > > > -- > Henri 'henux' Häkkinen > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Glsdk-devel mailing list > Gls...@li... > https://lists.sourceforge.net/lists/listinfo/glsdk-devel > > |
From: H. H. <hen...@gm...> - 2008-08-24 17:09:22
|
That is also what I think too. On Sun, Aug 24, 2008 at 8:06 PM, Branan Riley <br...@gm...> wrote: > Sounds good. Having names for the internal types in there makes it > harder to read, IMHO. > > On Sun, Aug 24, 2008 at 9:14 AM, Henri Häkkinen <hen...@gm...> > wrote: > > Yes. I hope we have reached a some sort of consensus that struct-unions > are > > the way to go. For now, I will define the math types with anonymous > unions > > and structures. We can use compiler magic to suppress warnings if need > be. > > > > typedef struct { > > union { > > GLfloat data[2]; > > struct { > > GLfloat x, y; > > }; > > }; > > } GLMvec2f; > > > > > > On Sun, Aug 24, 2008 at 5:16 PM, Stefanos A. <sta...@gm...> > wrote: > >> > >> > >> On Sun, Aug 24, 2008 at 6:31 AM, Branan Riley <br...@gm...> wrote: > >> > Could be a different version of MSVC giving different > >> > warnings. > >> > >> Actually no, just stricter warnings (warning level 4, where the default > >> is 3). GCC doesn't produce any warnings even with -Wall. > >> > >> However, please note that the anonymous union is *not* valid C89 (fails > >> to compile with "gcc -ansi"). I'm not saying this is a problem (//-style > >> comments aren't valid C89 either), just something to keep in mind and > >> document. > >> > >> // Not valid C89 > >> union > >> { > >> float data[2]; > >> struct { float x, y; }; > >> }; > >> > >> /* Valid C89 */ > >> union foo_union > >> { > >> float data[2]; > >> struct bar_struct { float x, y; } bar; > >> } foo; > >> > >> Anyone knows if these have been standardized in C99? > >> > >> > >> > ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your Move Developer's > >> challenge > >> Build the coolest Linux based applications with Moblin SDK & win great > >> prizes > >> Grand prize is a trip for two to an Open Source event anywhere in the > >> world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> Glsdk-devel mailing list > >> Gls...@li... > >> https://lists.sourceforge.net/lists/listinfo/glsdk-devel > > > > > > > > -- > > Henri 'henux' Häkkinen > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > Glsdk-devel mailing list > > Gls...@li... > > https://lists.sourceforge.net/lists/listinfo/glsdk-devel > > > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Glsdk-devel mailing list > Gls...@li... > https://lists.sourceforge.net/lists/listinfo/glsdk-devel > -- Henri 'henux' Häkkinen |