[cairo] RFC: converting public API to use const

Carl Worth cworth at cworth.org
Tue May 8 15:41:53 PDT 2007


On Tue, 8 May 2007 22:30:24 +0100, Chris Wilson wrote:
> Recently I've had the unpleasant task of having to cast calls to
> cairo_font_option_status() in order to avoid the compiler warnings when
> trying to call the function with a const cairo_font_options_t.

Is that in internal or external code?

> Does anyone have any objects to changing:
>     cairo_status_t cairo_font_options_status (cairo_font_options_t *);
> to
>     cairo_status_t cairo_font_options_status (const cairo_font_options_t *);
> i.e. can anyone identify a situation where this change will break the
> ABI or feels it is an incompatible change in the API?

If you needed it for internal code, then I don't see any benefit to
changing the external interface, (which perhaps raises some risk of
API break, so I'm glad you're asking the question here).

We've generally taken the stance that with pointers to opaque types,
there's no useful distinction to the user between a const and a
non-const interface.

So perhaps all that's needed is an internal-only interface that
provides the const, (since internally, the type isn't opaque any
more)?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070508/a60974ac/attachment.pgp


More information about the cairo mailing list