Skip to content
UPEEC

Advanced C

Macros, the memory model, concurrency, low-level tricks, linking, debugging tools and safety standards.

Advanced
Comments 0

This is an overview — pick a sub-topic below.

Sub-topics (22)

Preprocessor Macros

`#define` creates object-like and function-like macros expanded before compilation.

Easy♥ 0🔖 0💬 0

Conditional Compilation

`#if`, `#ifdef`, `#elif`, `#else` include code only for certain builds.

Easy♥ 0🔖 0💬 0

Macro Pitfalls

Macros are text substitution — missing parentheses, double evaluation and swallowed semicolons cause bugs.

Intermediate♥ 0🔖 0💬 0

C Memory Model

The rules for what values threads can see when they share memory (C11).

Advanced♥ 0🔖 0💬 0

volatile in Depth

`volatile` forces every access to really happen — for memory-mapped registers and variables changed by interrupts.

Intermediate♥ 0🔖 0💬 0

Atomics

Indivisible operations with defined memory ordering (`stdatomic.h`).

Advanced♥ 0🔖 0💬 0

Concurrency Basics in C

Threads share memory; protect shared data with mutexes or atomics and avoid deadlocks.

Advanced♥ 0🔖 0💬 0

C11 Threads

`threads.h`: `thrd_create`, `mtx_lock`, `cnd_wait` — portable threads (where supported).

Advanced♥ 0🔖 0💬 0

Signals in C

OS notifications sent to a process (SIGINT, SIGTERM, SIGSEGV), handled with `signal`/`sigaction`.

Intermediate♥ 0🔖 0💬 0

setjmp and longjmp

Save a point in execution and jump back to it later — non-local error recovery.

Advanced♥ 0🔖 0💬 0

Endianness

The byte order of multi-byte values in memory: little-endian (x86, ARM) vs big-endian (network order).

Easy♥ 0🔖 0💬 0

ABI

The Application Binary Interface: how compiled code agrees on type sizes, alignment, calling conventions and symbol names.

Advanced♥ 0🔖 0💬 0

Calling Conventions

Rules for passing arguments and return values in registers/stack and who saves which registers.

Advanced♥ 0🔖 0💬 0

Linking

The linker resolves symbols between object files and libraries and lays out the final program.

Intermediate♥ 0🔖 0💬 0

Static Libraries

Archives of object files (`.a`, `.lib`) copied into the executable at link time.

Intermediate♥ 0🔖 0💬 0

Shared Libraries

Libraries loaded at run time (`.so`, `.dll`, `.dylib`) shared between programs.

Intermediate♥ 0🔖 0💬 0

Debugging with GDB

Step through C programs, inspect variables and find crashes.

Easy♥ 0🔖 0💬 0

Sanitizers

Compiler instrumentation that catches bugs at run time: AddressSanitizer, UndefinedBehaviorSanitizer, ThreadSanitizer.

Intermediate♥ 0🔖 0💬 0

Valgrind

Runs a program on a virtual CPU to detect memory errors and leaks (Linux).

Intermediate♥ 0🔖 0💬 0

MISRA C

Coding guidelines for safety-critical C (automotive, medical, aerospace).

Advanced♥ 0🔖 0💬 0

Secure C Coding

Avoid buffer overflows, format-string bugs, integer overflows and use-after-free.

Intermediate♥ 0🔖 0💬 0

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.