|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2006-02-18 04:28:07
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Steve Cornett
> The file boost/preprocessor/stringize.hpp contains a trivial
> bug, for which I have attached a proposed patch. The problem
> is that there are three incorrect usages of the ## operator.
> The proposed fix is to simply remove the ## operators, as
> they are unnecessary.
>
> The ## operator joins two tokens and makes a new single
> token. But all three usages of ## in this file attempt to
> join an identifier with '(', which does not result in a
> single token. The action taken by most C/C++ translators in
> this situation is to rescan the invalid text back into two
> tokens, which makes the incorrect ## usage innocuous in most
> situations. However, the behavior is undefined by the C++
> and C standards. With our code coverage tool, this improper
> ## usage results in a warning.
Similar things are done all over the library, not just in 'stringize.hpp'.
I'm well aware that behavior of such use is undefined. However, they are
necessary workarounds for preprocessors that are broken in other ways. You will
never see it occur in the entire library if the library is preprocessed in its
strict configuration, for example. Suffice to say, they cannot be removed.
Regards,
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk