[cairo] "operator" keyword in libcairo
spitzak at d2.com
Wed Dec 29 13:43:49 PST 2004
On Tuesday 28 December 2004 05:15 pm, Chris wrote:
> On Tue, 2004-12-28 at 17:06 -0800, Ned Konz wrote:
> > On Tuesday 28 December 2004 2:14 pm, Chris wrote:
> > > I noticed that in libcairo there are tons of variables named
> > > "operator."
> > >
> > > Operator is a keyword in the Microsoft compiler and causes a lot of
> > > pain when trying to compile over there. I'm going to rename them to
> > > "op" or something and see how it goes from there.
> > It shouldn't be a keyword in a C compiler (though of course it is in
> > C++), should it? Do they also reserve new, delete, etc.?
> Good question. Maybe the compiler was working in C++ mode or something.
> It shouldn't be since they are all ".c" files as far as I know.
> Obviously something was tripping up though. I'll have to look into it.
It is not uncommon for people to configure MSVC to compile all ".c" files as
C++. This is because they want to use ".C" as the C++ extension, and
Microsoft refuses to let you use the case of the extension as a deciding
factor (this has NOTHING to do with case-insensitive file systems, it only
requires a case-preserving file system, which Windows has, so this is just
Microsoft being their normal pigheaded selves...). I have done this at times,
and have seen many other people with this setup.
I have generally found that if I want open source Windows stuff to compile as
C and not C++ I have to use the extern "C" in the source code, with #ifdef
c_plus_plus, much like a header file. No matter what the filename is, as
people have configured MSVC and the other Windows compilers (Borland, Cygwin,
etc) in all kinds of strange ways such that I have no way to control it other
It is also probably best to avoid all C++ keywords in all the code. You may
not believe it, but there is a remote chance that you might want to switch to
C++ or D or some other future language, so don't make it impossible.
More information about the cairo