Get the latest tech news

Lesser known tricks, quirks and features of C


There are some tricks, quirks and features (some quite fundamental to the language!) which seems to throw even experienced developers off the track. Thus I did a sloppy job of gathering some of them in this post (in no particular order) with even sloppier short explanations and/or examples (or quote of thereof).

This qualifier tells the compiler that a variable may be accessed by other means than the current code (e.g. we are dealing with MMIO device), thus to not optimize away reads and writes to this resource. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. In addition to that, many compilers offer as an extension (listed as common in Annex J of the C Standard) a feature called inline assembly, typically introduced to the code by the asm keyword.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Features

Features

Photo of quirks

quirks

Photo of Lesser known tricks

Lesser known tricks

Related news:

News photo

Samsung’s new Galaxy S24 FE brings AI features to a lower price

News photo

Discord opens Activities, in-app games and features, to all developers

News photo

Apple Intelligence Writing Tools: All the Features