Top "Unions" questions

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

Is there a way to access individual bits with a union?

I am writing a C program. I want a variable that I can access as a char but I can …

c structure bits unions
How do boost::variant and boost::any work?

How do variant and any from the boost library work internally? In a project I am working on, I currently …

c++ unions boost-variant boost-any
C: Where is union practically used?

I have a example with me where in which the alignment of a type is guaranteed, union max_align . I …

c++ c unions
C++ union array and vars?

There's no way to do something like this, in C++ is there? union { { Scalar x, y; } Scalar v[2]; }; Where x == …

c++ unions
C++11 anonymous union with non-trivial members

I'm updating a struct of mine and I was wanting to add a std::string member to it. The original …

c++ constructor c++11 anonymous unions
Can we use pointer in union?

If no why? Uses of union over structure??

c embedded unions
Interface for associative object array in TypeScript

I have an object like so: var obj = { key1: "apple", key2: true, key3: 123, . . . key{n}: ... } So obj can contain any …

typescript tuples associative-array unions
Unions and type-punning

I've been searching for a while, but can't find a clear answer. Lots of people say that using unions to …

c++ c unions type-punning
Accessing inactive union member and undefined behavior?

I was under the impression that accessing a union member other than the last one set is UB, but I …

c++ undefined-behavior language-lawyer unions
Union and Struct Initialization

I stumbled across a code based on unions in C. Here is the code: union { struct { char ax[2]; char ab[2]; } …

c unions