This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

__ESCAPE__ MACRO?

#define INTMAX_C(x) __ESCAPE__(x ## ll)

This Macro was copied from the ARM\RV\INC\stdint.h header file.
My question is the function of __ESCAPE__. It appears to be a predefined macro to implement an escape sequence. I have be unable to find the macro or any info. Is this a standard C macro? Did I miss something in my C classes a 100 years ago?
I have no problem. I would just like to know what I don't know.
Bradford

  • You should be fine by just defining:

    #define __ESCAPE__(x) x
    

    to allow you to glue together two symbols using the ## preprocessor operator.

    Long-time-ago, it was possible to use tricks like a/**/b or similar to glue symbols together, but the standard requires that a preprocessor must always replace comments with some form of white-space, to make sure that two symbols isn't inadvertedly converted to one. Hence, the need for the new preprocessor operator ##.

  • Thank you for your answer but it missed my question. I understand the ## tokens. They are standard preprocessor tokens. I don't understand the meaning of the keyword?? __ESCAPE__.
    Bradford

  • No, it isn't a standard macro. And it isn't a keyword. Keywords are normally written like:

    __cdecl
    __asm
    __asm__
    ...
    

    Symbols written __ESCAPE__ are normally defines. The dual underscores are used by compilers and some OS include files, to make sure that the defines doesn't clashes with user-defined symbols. Since __ESCAPE__ isn't a standard define, you might find it in include files supplied with one compiler, while not finding any reference to it in include files supplied with another compiler.