An opaque type hides its representation from client code. Users rely on functional interfaces rather than accessing fields, layout, or other implementation details. In C, FILE* illustrates the pattern: FILE identifies a stream, but its contents remain unknown; client code passes the pointer to functions such as fputc and fputs and can test whether it is null. section 8.4.1
int putchar(int c); int puts(char const s[static 1]);
The output interface exposes operations without exposing the representation of the stream object. section 8.4.1
Use opaque types according to these rules:
- Call the documented functions instead of depending on the hidden representation. section 8.4.1
- Do not infer field layout, base types, or other implementation details from the public typedef. section 8.4.1 section 19.5
jmp_buf hides an array type
The typedef jmp_buf is opaque: its base type and individual fields are unspecified. An object of type jmp_buf cannot be assigned, and passing it as a function parameter is rewritten to a pointer to its hidden base type. This supports setjmp and longjmp, but the declaration trick has awkward semantics and is explicitly unsuitable as a model for new types. section 19.5
[[noreturn]] void longjmp(jmp_buf target, int condition); int setjmp(jmp_buf target); // Usually a macro, not a function
setjmp and longjmp show the public operations that manipulate an opaque jmp_buf without exposing its representation. section 19.5



