clzo

Empty in define C?


Quick question about the following snippet:

#ifndef __LZO_MMODEL
#define __LZO_MMODEL            /*empty*/
#endif

In an empty define like this what does it represent?

It's used in like manner:

#define lzo_bytep               unsigned char __LZO_MMODEL *
#define lzo_charp               char __LZO_MMODEL *

Solution

  • Those answers do not cover many other possible cases.

    Another example.

    #ifndef DEBUG
    #define SINLINE static inline __attribute__((always_inline))
    #else
    #define SINLINE 
    #endif
    

    and then

    SINLINE void myfunc()
    {
       /* ... */
    }
    

    and if the DEBUG is defined function will not be inlined making it more debugger friendly.

    There are many other use cases.