Boost logo

Boost :

Subject: Re: [boost] [preprocessor] Sequences vs. All Other Data Structures
From: Edward Diener (eldiener_at_[hidden])
Date: 2012-04-24 09:00:34


On 4/24/2012 12:22 AM, Stephan T. Lavavej wrote:
> [Paul Mensonides]
>> It isn't that. VC++ doesn't even implement the preprocessor correctly for
>> C89. Essentially, the macro expansion algorithm appears to be
>> fundamentally broken. One small example:
>> #define A() 123
>> #define B() ()
>> A B() // should expand to A() (and does)
>> #define C() A B()
>> C() // should *still* expand to A() (but instead expands to 123)
>
> I have filed this as DevDiv#407151 "VC's preprocessor considered harmful (to Boost.Preprocessor)" in our internal database, including a copy of your entire mail.
>
> If it were within my power to fix this for you, I would - but I am not a compiler dev.

If you look at the Microsoft bug reporting page for preprocessors errors
you will see other problems with the preprocessor. A number of these are
basically the same problem with variadic macros, but others are just
basic erroneous proocessing of prepeocessor input and Microsoft's
response often is that it is the way the VC++ preprocessor works and
will not be changed even if it is erroneous.

Here are some links:

https://connect.microsoft.com/VisualStudio/feedback/details/385034/preprocessor-bug-two-tokens-may-be-joined-into-a-single-token

https://connect.microsoft.com/VisualStudio/feedback/details/380090/variadic-macro-replacement#details

https://connect.microsoft.com/VisualStudio/feedback/details/548580/c-preprocessor-expand-variadic-macro-in-wrong-order#details

https://connect.microsoft.com/VisualStudio/feedback/details/676585/bug-in-cl-c-compiler-in-correct-expansion-of-va-args

https://connect.microsoft.com/VisualStudio/feedback/details/718976/msvc-preprocessor-incorrectly-evaluates-variadic-macro-arguments-in-nested-macro-definition

https://connect.microsoft.com/VisualStudio/feedback/details/318940/macro-expansion-bug#details

https://connect.microsoft.com/VisualStudio/feedback/details/306850/c-preprocessor-broken-with-cpp-conditionals-in-code-using-a-macro#details

https://connect.microsoft.com/VisualStudio/feedback/details/288202/preprocessor-defines-macros-not-like-expected

https://connect.microsoft.com/VisualStudio/feedback/details/177051/invalid-preprocessor-function-like-macro-expansion#details

I know this is overkill to list these here, but it really is not done as
an attempt to embarass you or Microsoft. Rather it is proof of what Paul
has said, that Microsoft has taken the view that it is not important to
fix the prerocessor. Even if Microsoft were concerned with breaking
backward compatibility, ie. breaking code which uses the incorrect
implementation, in changing the preprocessor to actually be correct,
they could create a correct preprocessor and have a compiler switches to
enable the backward compatibility mode or the correct preprocessor mode
if they did so.


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