[cairo] make return buffers more obvious

Bill Spitzak spitzak at gmail.com
Fri Dec 18 11:43:15 PST 2015


On Fri, Dec 18, 2015 at 11:17 AM, Lawrence D'Oliveiro <
ldo at geek-central.gen.nz> wrote:

> On Fri, 18 Dec 2015 10:29:53 -0800, Bill Spitzak wrote:
>
> > Can const be used? Perhaps with a "#define const /*nothing*/" on
> > compilers that don't actually support it?
>
> Considering it became a standard part of C in *1989*, are there still
> serious C compilers around that can’t handle it?
>

I doubt it, but I could not understand why const is not being used or why
the original poster asked this question.

Basically if the function is:

    foo (cairo_bar* bar)

then it is defined as modifying *bar.

If the function is:

    foo (const cairo_bar* bar)

then it is not going to modify *bar.

It's too bad that C requires you to add a keyword in the more common const
case, but we have to live with that. Isn't this sufficient to make it clear
which functions modify the structures?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20151218/4ee745ec/attachment.html>


More information about the cairo mailing list