Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Apart from inlining for efficiency and conditional compilation, macros can be used to raise the abstraction level of low-level C code. C doesn't really insulate you from the nitty-gritty details of memory and resource management and exact layout of data, and supports very limited forms of information hiding and other mechanisms for managing large systems. With macros, you are no longer limited to using only the base constructs in the C language: you can define your own data structures and coding constructs (including classes and templates!) while still nominally writing C! </p> <p>Preprocessor macros actually offer a <a href="http://en.wikipedia.org/wiki/Turing_complete" rel="noreferrer">Turing-complete</a> language executed at compile time. One of the impressive (and slightly scary) examples of this is over on the C++ side: the <a href="http://www.boost.org/doc/libs/1_38_0/libs/preprocessor/doc/index.html" rel="noreferrer">Boost Preprocessor</a> library uses the <a href="http://en.wikipedia.org/wiki/C_(programming_language)" rel="noreferrer">C99</a>/<a href="http://en.wikipedia.org/wiki/C_Plus_Plus" rel="noreferrer">C++98</a> preprocessor to build (relatively) safe programming constructs which are then expanded to whatever underlying declarations and code you input, whether C or C++. </p> <p>In practice, I'd recommend regarding preprocessor programming as a last resort, when you don't have the latitude to use high level constructs in safer languages. But sometimes it's good to know what you can do if your back is against the wall and the weasels are closing in...! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload