Re: #ifdef __cplusplus
In article <47FE67CA.13ABE 6C@spamcop.net> ,
Kenneth Brody <kenbrody@spamc op.netwrote:
Some of those tests are, to some degree, plausible. There could be
some reason for some system to behave like that. Some are less so.
There are even more absurd possiblities, such as only accepting one
particular program that reaches the various minimum implementation
limits. Having a C90 implementation define __cplusplus is in the
"completely absurd" category; no realistic implementation would do it
on any platform, so there is no point having a stress test for it.
It makes no more sense to write your program to accommodate such
implementations than to allow for ones where addition sometimes
doesn't work.
-- Richard
--
:wq
In article <47FE67CA.13ABE 6C@spamcop.net> ,
Kenneth Brody <kenbrody@spamc op.netwrote:
>But this whole argument is silly. A conforming C90 implementation
>could define __cplusplus, but it would be a stupid implementation and
>people would reject it. You can find a whole host of things that the
>standard doesn't prohibit, but which would make a compiler a laughing
>stock.
>could define __cplusplus, but it would be a stupid implementation and
>people would reject it. You can find a whole host of things that the
>standard doesn't prohibit, but which would make a compiler a laughing
>stock.
>Well, one could make an implementation to "stress test" C source code,
>with things like making NULL not all-bits zero (perhaps even making
>an all-bits-zero pointer a trap representation) , converting between
>pointers and ints/longs and back resulting in invalid pointers, (is
>it valid to have sizeof(void*) sizeof(long)?), returning pointers
>in a different register than non-pointers, and so on.
>with things like making NULL not all-bits zero (perhaps even making
>an all-bits-zero pointer a trap representation) , converting between
>pointers and ints/longs and back resulting in invalid pointers, (is
>it valid to have sizeof(void*) sizeof(long)?), returning pointers
>in a different register than non-pointers, and so on.
some reason for some system to behave like that. Some are less so.
There are even more absurd possiblities, such as only accepting one
particular program that reaches the various minimum implementation
limits. Having a C90 implementation define __cplusplus is in the
"completely absurd" category; no realistic implementation would do it
on any platform, so there is no point having a stress test for it.
It makes no more sense to write your program to accommodate such
implementations than to allow for ones where addition sometimes
doesn't work.
-- Richard
--
:wq
Comment