[cairo] Call for testers: Const status accessors

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Fri Aug 5 01:34:33 PDT 2011


On Fri, 5 Aug 2011, Andrea Canciani wrote:

> The attached patch modifies cairo status accessors to accept a const
> argument. This should be ok with C, but other languages might have
> different issues.

Cairo shouldn't be exporting const opaque pointer types since it's
none of the callers business what happens inside an opaque object.
Const correctness in APIs isn't relevant in C unless the caller has
full visibility into the structure and layout of an object.  IMHO
using constness of an opaque pointer to reflect an operation's
mutation-freeness of the underlying object, as seems to be the case in
this patch, is an abuse of a perfectly fine qualifier, especially in
C.  C++ in particular is a different case all together as it has much
more support for this kind of semantic tagging using the const
qualifier.

Joonas


More information about the cairo mailing list