A typed, unnamed object
```c unsigned value = ((unsigned){ 7 }); ``` The syntax is a parenthesized type name followed by an initializer: `(T){ INIT }`. The expression creates an unnamed object of type `T`; it is therefore not a constant in C’s narrow sense. **TAKEAWAY:** A compound literal defines an object. section 5.6.4
Compound literals are useful when a macro needs a value with a chosen aggregate type. For example, a macro can expand to a `const` array initialized with designated elements, allowing indexed use without a separately declared array. Leave a space between the macro name and the literal’s `()`; otherwise the preprocessor can read it as a function-like macro definition. section 5.6.4
(T){ INIT }
Use this compact syntax pattern to recognize the type-and-initializer structure. section 5.6.4
Several rules distinguish compound literals from ordinary constants and declarations:
- An automatic compound literal’s initializer is evaluated each time execution reaches its definition. section 13.3
- For an object that is not a variable-length array, its lifetime begins when its scope is entered and ends when that scope is left. section 13.3
- A compound literal can enforce assignment compatibility in a macro: `((T){ 0 } = (X))` assigns the argument to a temporary object of type `T`, enabling compiler checking. section 16.2
- Do not hide a terminating semicolon inside a macro definition; the replacement is text, and the caller should supply the statement terminator. section 5.6.4
Lifetime and address behavior
```c void fgoto(unsigned n) { unsigned j = 0; unsigned *p = 0, *q; AGAIN: if (p) printf("%u: %s, *p is %u\n", j, q == p ? "equal" : "unequal", *p); q = p; p = &((unsigned){ j, }); ++j; if (j <= n) goto AGAIN; } ``` Each visit evaluates the initializer again. The demonstrated output shows successive values `0` and `1`; when the same literal is revisited through the jump, its address relationship is defined by the object’s scope and lifetime. section 13.3

