liveBook · Manning

Type-generic interface

A type-generic interface is a programming interface that selects or adapts operations according to the types of its arguments or associated values.

How 2 Manning books explain it

Modern C, Third Edition

Type-generic programming is a programming technique that selects or adapts operations according to the types of values involved.

How it is used
Provides shared C interfaces that adapt operations to argument types and qualifications.
How deep it goes
Explains macro expansion, arithmetic conversions, function selection, and const preservation through concrete interfaces and their constraints.
Examples
Uses gray-value arithmetic, fabs dispatch, const-preserving strstr calls, and exercises extending generic macros.
What you can do after
Builds type-generic macro interfaces using arithmetic conversions or _Generic to select functions.

Read how Modern C, Third Edition explains type-generic interface →

Modern C

Type-generic programming is a technique for providing one interface that selects or adapts behavior according to the types of its inputs.

How it is used
Deploys macros with _Generic to present one type-safe interface over several type-specific functions or values.
How deep it goes
Explains _Generic selection and multi-argument dispatch, then demonstrates practical macro utilities without developing every language corner case.
Examples
Uses fabs dispatch, floating-point minimum, maximum-value selection, and tracing formats and conversions as concrete implementations.
What you can do after
Builds type-generic C11 macro interfaces that dispatch to typed functions or expressions while avoiding unnecessary macro evaluation hazards.

Read how Modern C explains type-generic interface →

What to know first

Related concepts

Questions about type-generic interface

What is type-generic interface?

A type-generic interface is a programming interface that selects or adapts operations according to the types of its arguments or associated values.

Which Manning books explain type-generic interface?

Modern C, Third Edition and Modern C.

What should I know before learning type-generic interface?

Manning books that teach type-generic interface usually introduce C11, function pointer type, function type and _Generic first.

What is the difference between type-generic interface and atomic type?

A type-generic interface is a programming interface that selects or adapts operations according to the types of its arguments or associated values. An atomic type is a type whose supported accesses and operations are indivisible with respect to concurrent execution and provide defined synchronization semantics.

What is type-generic interface a kind of?

Type-generic interface is a kind of interface. An interface is a contract or boundary that specifies the operations, members, or data shape a type or component exposes, without prescribing its complete implementation.

What are the parts of type-generic interface?

Type-generic interface includes type-generic macro.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.