Top "Unions" questions

The plural of a keyword in the C family of languages for declaring a union data type.

Difference between a Structure and a Union

Is there any good example to give the difference between a struct and a union? Basically I know that struct …

c struct unions
What does "request for member '*******' in something not a structure or union" mean?

Is there an easy explanation for what this error means? request for member '*******' in something not a structure …

c struct unions
Why do we need C Unions?

When should unions be used? Why do we need them?

c unions
Purpose of Unions in C and C++

I have used unions earlier comfortably; today I was alarmed when I read this post and came to know that …

c++ c unions type-punning
How to compile C code with anonymous structs / unions?

I can do this in c++/g++: struct vec3 { union { struct { float x, y, z; }; float xyz[3]; }; }; Then, vec3 v; …

c++ c struct anonymous unions
When would anyone use a union? Is it a remnant from the C-only days?

I have learned but don't really get unions. Every C or C++ text I go through introduces them (sometimes in …

c++ c unions
sizeof a union in C/C++

What is the sizeof the union in C/C++? Is it the sizeof the largest datatype inside it? If so, …

c++ c sizeof unions
Why does C++ disallow anonymous structs?

Some C++ compilers permit anonymous unions and structs as an extension to standard C++. It's a bit of syntactic sugar …

c++ struct unions
C++ union in C#

I'm translating a library written in C++ to C#, and the keyword 'union' exists once. In a struct. What's the …

c# c++ unions
How to use c union nested in struct with no name

I'm working on the so called Hotspot open source project, and looking at the implementation I found a nasty nested …

c++ c unions anonymous