Commit graph

1 commit

Author SHA1 Message Date
Claude f793695503
Add advanced C programming tutorials: preprocessor, macros, and memory management
Comprehensive tutorials for advanced C topics:

- 15_preprocessor_macros.md (800+ lines)
  * Complete preprocessor guide
  * #include, #define, conditional compilation
  * Header guards, function-like macros
  * Multi-line macros, stringification, token pasting
  * Predefined macros, best practices
  * Extensive Clay examples showing macro patterns

- 16_advanced_macros.md (900+ lines)
  * Variadic macros with __VA_ARGS__
  * X-Macros pattern for code generation
  * _Generic for type-based selection (C11)
  * Compound literals and statement expressions
  * For-loop macro trick (Clay's CLAY() macro explained)
  * Designated initializers in macros
  * Recursive macro techniques
  * Complete breakdown of Clay's macro system

- 17_memory_management.md (850+ lines)
  * Stack vs heap memory comparison
  * malloc, calloc, realloc, free usage
  * Common memory errors and prevention
  * Memory leak detection with Valgrind
  * Arena allocators (Clay's approach)
  * Memory pools for performance
  * Memory alignment optimization
  * Custom allocators
  * Clay's zero-allocation strategy
  * Best practices and profiling

All files include:
- 50+ code examples per chapter
- Real Clay library usage throughout
- Practice exercises
- Performance considerations
- Professional patterns

Total new content: ~2,500 lines of detailed tutorials
2025-11-14 06:40:51 +00:00