Skip to main content

One post tagged with "Macros"

C macros and their usage

View All Tags

How the API_AVAILABLE Macro Works on macOS: C Preprocessor Deep Dive

· 6 min read
Pranav Ram Joshi
Software Engineer — Systems & Networks

There are various ways one could use C preprocessor macros. Learning how to properly use them — or failing to — can end up producing some bizarre codebases. If you have ever encountered the <os/availability.h> (see Apple os/availability.h source (GitHub — apple-oss-distributions)) header file on macOS, you'll find some macros that are confusing to interpret.

The API_AVAILABLE Macro Definition

The macro is defined as follows: