Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2003-01-07 11:26:10


"Terje Slettebø" <tslettebo_at_[hidden]> wrote in message
news:031901c2b661$a1f9c9a0$cb6c6f50_at_pc...
> The types yes_type and no_type (or equivalent) - that is, two types which
> are guaranteed to have different size -
[snip]
> By the way, these are defined as char and double, respectively. Are these
> required to have different size? I haven't found that guarantee in the C++
> or C standard. Theoretically, you might have an architecture which
operated
> only on values of one size, so that char and double would have the same
> size.
>
> In that case, maybe something like this could be safer:
>
> typedef char yes_type[1];
> typedef char no_type[2];
>
>
There are many variants, e.g.:

typedef double yes_type;
typedef yes_type no_type[2];

/Pavel


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