Boost logo

Boost :

Subject: Re: [boost] [clang][preprocessor] Testing of clang emualting the VC++ preprocessor on Windows
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-03-30 20:22:43

On 31/03/2016 12:56, Edward Diener wrote:
> I suggested to the clang developers, based also on some other people's
> comments, that it should be possible of them to setup their VC++
> targeting so that the emulated VC++ preprocessor is used to expand
> macros when it is needed for certain header files ( Windows API, VC++
> compiler distributed header files ) but that their C++ standard
> processor should be used otherwise. But they evidently did not want to
> do that. Even such a simple scheme as having a #pragma to specify one or
> the other preprocessor behavior they did not want to consider.
> Asking programmers to support another broken C++ preprocessor at this
> stage of C++'s development history is a travesty. And all simply because
> Microsoft has refused for a quarter of a century to fix their C++
> preprocessor implementation, which they well know has always been
> non-standard.

Presumably they both have the same motivations: trillions (or likely
much higher) of lines of existing code, some unknown fraction of which
might depend on the quirks of the existing behaviour.

Bear in mind that one of clang's goals is not just to compile new
portable programs but also existing previously-MSVC-only codebases, with
minimal (or no) changes to the code.

Not sure why they didn't want to have #pragma control, though, as that
seems like a good compromise. Perhaps because this would require the
preprocessor to track some extra metadata, since it would need to know
at expansion time whether the macro was defined in a block with the
pragma in effect or not -- using the pragma state at the point of
expansion would be too limiting and not practically useful. This could
pose some fun if non-conforming macros use conforming macros or vice versa.

Boost list run by bdawes at, gregod at, cpdaniel at, john at