liveBook · Manning

Function decay

Function decay is the C conversion of a function designator to a pointer to that function except in contexts such as sizeof and unary &.

How 2 Manning books explain it

Modern C, Third Edition

Function decay is the C conversion in which an expression designating a function is converted to a pointer to that function in applicable contexts.

How it is used
Uses function decay to pass functions as callbacks and invoke them through function pointers.
How deep it goes
Explains conversion rules, equivalent call forms, declarations, callbacks, and comparison safety, stopping short of broader pointer internals.
Examples
Demonstrates equivalent calls, atexit declarations, qsort callbacks, safe unsigned comparison, and overflow-prone integer comparison.
What you can do after
Apply it via function-pointer callbacks and distinguish safe comparison implementations from overflow-prone ones.

Read how Modern C, Third Edition explains function decay →

Modern C

Function decay is the C conversion in which an expression naming a function is evaluated as a pointer to that function, except in contexts that suppress the conversion.

How it is used
Uses function decay to pass callbacks and select functions through function-pointer interfaces.
How deep it goes
Defines decay, compares declaration forms, and traces call expressions, while deferring broader pointer details.
Examples
Demonstrates equivalent calls, callback declarations, generic comparison functions, sorting, searching, and selectable logging.
What you can do after
Apply function decay when declaring, passing, storing, and invoking callback functions.

Read how Modern C explains function decay →

Related concepts

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.