Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Union, tagged union?

También llamado: union (C) · tagged union

Definition 6.5 University Computer Science — Year 1 · Capítulo 6 — Strings, Structures and Files

A union is a type whose members all start at the same address and share the same storage: its size is that of its largest member, and only the member last written holds a meaningful value. A tagged union is a structure holding a union and a field, the tag, that records which member is in use.

A tagged union of 24 bytes. The same 16 bytes hold a radius or a width and a height; the tag (4 bytes, then 4 bytes of padding so the double starts at offset 8) says which reading is meaningful.
A tagged union of 24 bytes. The same 16 bytes hold a radius or a width and a height; the tag (4 bytes, then 4 bytes of padding so the double starts at offset 8) says which reading is meaningful.
Leer en el capítulo →