Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2000-01-07 23:41:42


"outlaw" <outlaw_at_[hidden]> writes:

| > Therefore, I have made 'signed char' a signed integral type, 'unsigned
| char'
| > an unsigned integral type, and 'char' an integral type that is neither
| > signed nor unsigned. I claim that this makes sense, even on systems where
| > 'char' is (for example) signed, because 'char' and 'signed char' are still
| > distinct types (3.9.1p10).
|
| I've always interpreted that section of the standard as such, whereby char,
| signed char, and unsigned char are three distinct types.

True.

| ... Would it be
| possible to determine if a compiler interprets the standard likewise using
| an attempted implicit type conversion?

No conforming programming cantell (assuming the compiler gets it
right :-)

| .. On my compiler all the following
| assignment attempts fail with "cannot convert from 'x *' to 'y *' Types
| pointed to are unrelated; conversion requires reinterpret_cast, C-style cast
| or function-style cast".
|
| char* pa;
| signed char* pb;
| unsigned char* pc;

Not just because a 'char' can be implicitly converted to a 'int', that
implies a 'char*' can be implicitly converted to 'int*'.

-- Gaby


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