Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Metaprogramming with X-Macros

Metaprogramming with X-Macros

Melbourne Cocoaheads presentation on using X-Macros to generate code.

Associated code: https://github.com/orj/XMacroExamples

Oliver Jones

March 21, 2013
Tweet

Other Decks in Programming

Transcript

  1. $ whoami Oliver Jones Senior Developer @ Itty Bitty Apps

    http:/ /iamorj.com @orj on Twitter (and Xbox, Steam, etc)
  2. Metaprogramming with X Macros Or: How I learned to stop

    worrying and love the preprocessor.
  3. What is the preprocessor? Part of C99 & C++ standards

    ObjC adds #import Was separate process, clang has one built in
  4. What is the preprocessor? Part of C99 & C++ standards

    ObjC adds #import Was separate process, clang has one built in Macro language
  5. What is the preprocessor? Part of C99 & C++ standards

    ObjC adds #import Was separate process, clang has one built in Macro language Turing complete
  6. Turing what? In computability theory, a system of data-manipulation rules

    (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing complete or computationally universal if it can be used to simulate any single-taped Turing machine.
  7. all the # you need to know 2 flavours of

    macro object-like macros function-like macros
  8. Links Boost C++ Preprocessor Library http:/ /www.boost.org/doc/libs/1_53_0/libs/preprocessor/doc/ Boost Book (Preprocessor

    Chapter) http:/ /www.boostpro.com/mplbook/preprocessor.html Stack Overflow on X Macros: http:/ /bit.ly/15ZXZpt Dr Dobbs Journal http:/ /www.drdobbs.com/cpp/the-x-macro/228700289