Suggested addition for BOOST_WORKAROUND

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.

Gennaro Prota wrote:
PS: Giovanni, I asked you in private mail a while ago. What does your 'typo revealing' patch do?
I don't recall. What does the diff look like? I think it was about actually *using* the identifier in the expression, but I don't remember why. It was fixing a real world problem of mine though. -- Giovanni Bajo

On Tue, 23 Mar 2004 11:57:52 +0100, "Giovanni Bajo" <giovannibajo@libero.it> wrote:
Gennaro Prota wrote:
PS: Giovanni, I asked you in private mail a while ago. What does your 'typo revealing' patch do?
I don't recall. What does the diff look like? I think it was about actually *using* the identifier in the expression,
It is unlikely an identifier, but even if it is #define VERSION 0x551 #if ... BOOST_TESTED_AT(VERSION) I don't understand. What does ((value) - (value)) catch?
but I don't remember why. It was fixing a real world problem of mine though.
This is your original message: http://lists.boost.org/MailArchives/boost/msg47407.php Genny.

Gennaro Prota wrote:
This is your original message: http://lists.boost.org/MailArchives/boost/msg47407.php
I don't understand. What does ((value) - (value)) catch?
Now I remember: #if BOOST_WORKAROUND(WHATEVER, 5F4) // missing '0x' #endif This is caught with my patch, but goes unnoticed without. -- Giovanni Bajo

On Wed, 24 Mar 2004 15:48:11 +0100, "Giovanni Bajo" <giovannibajo@libero.it> wrote:
Gennaro Prota wrote:
This is your original message: http://lists.boost.org/MailArchives/boost/msg47407.php
I don't understand. What does ((value) - (value)) catch?
Now I remember:
#if BOOST_WORKAROUND(WHATEVER, 5F4) // missing '0x' #endif
This is caught with my patch, but goes unnoticed without.
Yes, 5F4 is a valid pp-number, just like 5zz or 0b9 :) Thanks, Genny.
participants (2)
-
Gennaro Prota
-
Giovanni Bajo