CKTIS / C
ABI and representation — concept C23
An ABI is the binary contract between separately compiled parts: calling convention, type sizes and alignment, structure layout, and data representation. The C standard defines no single ABI; linking objects built with incompatible options, packing, or calling conventions can corrupt arguments and memory.
Version: C23
Syntax
ABI and representationAn ABI is the binary contract between separately compiled parts: calling convention, type sizes and alignment, structure layout, and data representation. The C standard defines no single ABI; linking objects built with incompatible options, packing, or calling conventions can corrupt arguments and memory.
An ABI matters in practice when linking a shared library, FFI boundary, plug-in, or object built by another compiler. A public header should use agreed types and conventions, and an integration check should compare sizeof, alignof, and offsetof on both sides.
Edge cases include structure padding, bit-field order and width, endianness, symbol naming, and packing options. A raw structure image is not a durable file or network format; fields need explicit serialization.
Examples
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
struct Message { uint32_t code; unsigned char flag; };
int main(void) {
printf("%d\n", offsetof(struct Message, flag) >= sizeof(uint32_t));
return 0;
}
Result
1
An ABI is the binary contract between separately compiled parts: calling convention, type sizes and alignment, structure layout, and data representation. The C standard defines no single ABI; linking objects built with incompatible options, packing, or calling conventions can corrupt arguments and memory.