Top "Unions" questions

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

Best practice for unions in Go

Go has no unions. But unions are necessary in many places. XML makes excessive use of unions or choice types. …

go unions
Is type-punning through a union unspecified in C99, and has it become specified in C11?

A number of answers for the Stack Overflow question Getting the IEEE Single-precision bits for a float suggest using a …

c c99 unions c11 type-punning
C union type in Swift?

How can I declare and use a C union type in Swift? I tried: var value: union { var output: CLongLong …

c swift unions
Union and struct packing problem

I'm writing some software where each bit must be exact(it's for the CPU) so __packed is very important. typedef …

c struct unions packing
union members may not have constructors, but `std::pair` okay?

union members may not have destructors or constructors. So I can't template the following class Foo on my own MyClass …

c++ constructor unions std-pair
Accessing C union members via pointers

Does accessing union members via a pointer, as in the example below, result in undefined behavior in C99? The intent …

c pointers unions
C++ anonymous structs

I use the following union to simplify byte, nibble and bit operations: union Byte { struct { unsigned int bit_0: 1; unsigned int …

c++ struct unions anonymous-struct
Is a Union Member's Destructor Called

C++11 allowed the use of standard layout types in a union: Member of Union has User-Defined Constructor My question then …

c++ c++11 destructor unions standard-layout
Anonymous union and struct

How would you go about doing this in standard C++11/14 ? Because if I'm not mistaken this isn't standard compliant code …

c++ c++11 struct unions