|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2004-03-21 08:29:55
Hi,
as pointed out when BOOST_WORKAROUND was being discussed, Borland C++
(I think, up to 0x600 excluded) just emits an optional warning for
division by zero. The warning is enabled by default, but can be turned
off with -w-zdi or -w-8082. So I (re)propose to add a special
BOOST_WORKAROUND implementation for it:
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600)
// Borland needs a special version, as it just emits a warning for
// division by zero (and you can even disable it with -w-zdi or
// -w-8082 !!). But it supports sizeof expressions in #if-s
// (NOTE: that's non-conforming)
//
# define BOOST_WORKAROUND(symbol, test) \
(((symbol) != 0) && (1 != sizeof(char[1 + ((symbol) test)]) ))
#else
# define BOOST_WORKAROUND(symbol, test) \
((symbol != 0) && (1 % (( (symbol test) ) + 1)))
...
Notes:
a) it should be verified whether version 0x600 has the same problem or
not; given that it uses an EDG front-end it probably won't, but who
knows what they could have decided in the name of backward
non-conformity :)
b) I suggest to use __BORLANDC__ directly, instead of the (maybe)
upcoming BOOST_BORLAND_xxx, to avoid including config.hpp for such a
simple header.
PS: Giovanni, I asked you in private mail a while ago. What does your
'typo revealing' patch do?
-- Genny.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk