Thread: @have_stdint_h@

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    23

    @have_stdint_h@

    I am porting an open source library to a system without make or cmake.
    I have encountered this construct in one of the headers

    #define HAVE_STDINT_H @HAVE_STDINT_H@
    #if HAVE_STDINT_H ...

    what is the meaning of that construct?
    who is supposed to set the value and how?

    my compiler understand it literally as the string "@HAVE_STDINT_H@"

    Thank you
    ZA

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    25,911
    Presumably @HAVE_STDINT_H@ is some kind of CMake configuration variable that will evaluate to true in the preprocessor when <stdint.h> is available. So, if <stdint.h> is available, HAVE_STDINT_H will be true, so the conditional code will be present for compiling, but if it is not available, HAVE_STDINT_H will be false or empty, so the conditional will not be present for compiling.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    23
    Thank you for the explanation.
    That means that the C compiler/macro processor should understand @xxx@ as an externally supplied value and I assume that gcc works that way. I have no sign that my compiler (IBM C for z/OS) complies with that convention. Oh well
    ZA

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    25,911
    Quote Originally Posted by zatlas1
    That means that the C compiler/macro processor should understand @xxx@ as an externally supplied value and I assume that gcc works that way.
    No, it is more likely to be something that CMake's own system would replace before any of C's stages of translation. If you already know that the compiler is gcc, then there would be no need for such a configuration variable: with gcc, whether or not <stdint.h> is available depends on whether you compile with respect to C99 (or later, assuming a hosted implementation), so you would use the standard predefined macro __STDC_VERSION__ to check.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Tags for this Thread