[cairo] cairomm: Visual Studio WIN32 define clash with Surface::Type::WIN32

James K. Lowden jklowden at schemamania.org
Wed Jan 6 14:59:38 UTC 2021


On Wed, 6 Jan 2021 11:05:24 +0100
Francesco Pretto <ceztko at gmail.com> wrote:

> Much software will break if WIN32 is not defined, in my experience
> much more than 50% of software either using WIN32 or _WIN32.

With apologies to Billy Crystal, there's a big difference between
_WIN32 and mostly _WIN32.  

You're right that upon a time WIN32 was widely used, and that 10 years
ago (at least) Microsoft switched to _WIN32.  

There's no need for the Cairo source code, which obvious doesn't rely on
WIN32 to be defined, to allow a spurious macro definition to break the
build, or to rename its enumerated type.  After all, even *Microsoft*
doesn't require WIN32 to be defined anymore.  

The best solution ISTM is to add

	#undef WIN32

somewhere early in the Cairo header files, and document it
accordingly.  Short of that, document it only, and caveat emptor.
Developers should minimize use of the preprocessor, and definitely
not define macros that don't need to be defined!  

>  or read the words of the project maintainer Brad King[3].

As I read his words, he was asking for the nonexistent, namely official
Microsoft documentation for WIN32.  Four years ago he said that 14
years prior CMake had defined WIN32 because "the project ... wanted it
defined". Two decades ago, that was common practice.  No need to
promulgate it further today.  

--jkl


More information about the cairo mailing list