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
characters
#if '\200' != 128
#error must compile char as unsigned
#endif

     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
     compiling.
     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
SmarterKids.com. Hurry, offer expires 1/15/00.
http://click.egroups.com/1/646/1/_/9351/_/947367635/

-- Create a poll/survey for your group!
-- http://www.egroups.com/vote?listname=boost&m=1


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk