[cairo] gcc warnings issue

Owen Taylor otaylor at redhat.com
Tue Aug 9 08:34:05 PDT 2005

On Tue, 2005-08-09 at 14:48 +1000, Benno Rice wrote:
> Hey,
> I'm tinkering with some cairo-based stuff on FreeBSD and out of interest 
> (and because I'm somewhat anal) I turned a whole bunch of warnings on. 
> This immediately caused a whole slew of warnings resulting from -Wshadow 
> and the fact that on FreeBSD (at least) /usr/include/math.h defines a 
> function called y1 which triggers warnings based on the arguments named 
> y1 in various functions in cairo.h.
> Would it be possible to rename some of these variables from x1, y1, etc 
> to something else that won't conflict?  I'm happy to do the work of 
> generating a patch, I just wanted to solicit ideas about what they 
> should be renamed to, or if such renaming was acceptable.

The policy we decided to take for GLib and GTK+ was whenever we had a
function parameter that would conflict with system call names

 clear, index, rand, time, link, y1

We simply appended an underscore

 clear_, index_, rand_, time_, link_, y1_

Rather than trying to come up with a new naming scheme in some unique
way. (For gdk_draw_line() we did rename x1 => x1_, x2 => x2_ to keep
things consistent )

If you do it this way then you can say for that for a language binding
where parameter names are part of the API (like Python) the _ should
simply be dropped.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050809/bdee0f7c/attachment.pgp

More information about the cairo mailing list