[cairo] C89 compatibility of cairo-svg-surface.c

Tobias Fleischer (reduxFX) tobias.fleischer at reduxfx.com
Sun Feb 13 08:04:43 UTC 2022


Here is something I noticed today that will probably not affect many
people, but I still wanted to bring it up:
The file cairo-svg-surface.c was extensively changed between the latest
1.17.2 source code release and the current version, which is fine (progress
is always good!).
However, the newly added code does not conform to the C89 standard (as the
only file Cairo's vast C codebase). The reason for that being that
variables are declarded not at the beginning of each function, like with
all other Cairo source files, but whenever they are needed inside the
function body.
That makes it impossible to compile Cairo with certain old compilers. As I
said, this is very likely not an issue to most people out there, but I have
to maintain a legacy project using Cairo in Visual Studio 2012, so I was
stuck there. I fixed this manually by moving the variable declarations to
the beginning of each function in that file, but there were almost 300
locations in the code where I had to do this.

I am not sure if such a fix/information is relevant to anyone else but me
who has to work with such archaic technology, or if it is intended to make
this file C89 compliant in future anyway, but I just wanted to mention this.

Cheers,
Toby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20220213/7dcbb06f/attachment.htm>


More information about the cairo mailing list