CKTIS / C
object model and composition — concept C23
A C object is storage with a type, lifetime, and representation; reading requires a live object and a permitted access type. Structure assignment copies fields, but pointer fields remain shallow references.
Version: C23
Syntax
object model and compositionA C object is storage with a type, lifetime, and representation; reading requires a live object and a permitted access type. Structure assignment copies fields, but pointer fields remain shallow references.
Compose data with nested struct values and explicit pointers, stating whether each pointer field borrows or owns its object. Structure assignment works for value fields, but after a shallow copy two objects may refer to the same dynamic buffer.
After lifetime ends, stored bytes do not automatically form a live object. Access through an incompatible type, a misaligned pointer, or an inactive union member needs the standard’s rules; padding should participate in neither equality nor serialization.
Examples
#include <stdio.h>
struct Point { int x; int y; };
int main(void) { struct Point p = {.x = 2, .y = 5}; struct Point copy = p; printf("%d\n", copy.x + copy.y); return 0; }
Result
7
A C object is storage with a type, lifetime, and representation; reading requires a live object and a permitted access type. Structure assignment copies fields, but pointer fields remain shallow references.