Re: make return buffers more obvious

Bill Spitzak <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAL-8oAjVpQgh5LqNZo=D2bj+uKcVscrpcvvVPqBTj6hsfMoFUg@mail.gmail.com>
On Fri, Dec 18, 2015 at 11:17 AM, Lawrence D'Oliveiro <
[email protected]> 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?

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.