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

Dave Yeo dave.r.yeo at gmail.com
Sun Feb 13 08:16:22 UTC 2022

On 02/13/22 12:04 AM, Tobias Fleischer (reduxFX) wrote:
> 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.

Now that you've done the work, why not make a commit and then try to get 
it committed here? Even with newer compilers, there are warnings and 
fixing warnings is usually good.

More information about the cairo mailing list