Boost logo

Boost :

From: Jon Jagger (Jon.Jagger_at_[hidden])
Date: 2000-01-09 04:39:20

At 05:41 AM 1/8/00 +0100, Gabriel Dos Reis wrote:

>| ... Would it be
>| possible to determine if a compiler interprets the standard
likewise using
>| an attempted implicit type conversion?
>No conforming programming can tell (assuming the compiler gets it
>right :-)

I am not sure exactly the question you were asking, but here is some
code from one of my programs which determines if the compiler is
treating char as unsigned:

// verify char being compiled as unsigned; requirement for Latin-1
#if '\200' != 128
#error must compile char as unsigned

     Is this portable? I thought that there was no requirement
     that the types used by the preprocessor had to be the same
     as the types used by the compiler. After all, you can
     have stand alone preprocessors. Or you might be cross
     Can't you do this as a compile time assertion?

     char must_be_unsigned['\200' == 128];

     which you could put inside a struct if you want
     a declaration rather than a definition. Or you
     could use a compile time assertion trait which
     Kevlin has written about...

     Jon Jagger

Toys, Books, Software. Save $10 on any order of $25 or more at Hurry, offer expires 1/15/00.

-- Create a poll/survey for your group!

Boost list run by bdawes at, gregod at, cpdaniel at, john at