On 10/12/2010 02:06 AM, José Fonseca wrote:
What you guys feel about anonymous unions?

I happened to committed some code with anonymous unions, but it caused
gcc to choke when -std=c99 option is specified, which is only specified
with automake but scons.

After some search, it looks like anonymous unions are not part of C99,
but are part of C++ and will reportedly be part of C1X [1]. I think all
major compilers support it.

I heard they are also often used together with bit fields to describe
hardware registers.

But for this to work to gcc we need to remove -std=c99, or replace with
-std=gnu99, or pass -fms-extensions together with -std=c99.

I don't care much either way. I'd just like to hear what's the general
opinion on this to avoid ping-ponging on this matter.

Jose

[1] http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html#Unnamed-Fields

When I have a choice, I prefer to go with what is more portable. I think this is especially important for core Mesa/gallium to maximize portability to new compilers/platforms. You never know what's going to come along.

-Brian

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to