[cairo] Const correctness?
Bryce Harrington
bryce at osg.samsung.com
Fri Feb 17 17:01:44 UTC 2017
On Thu, Feb 16, 2017 at 09:37:57AM +0100, Torbjörn Rathsman wrote:
> Function retrieving image width:
>
> int cairo_image_surface_get_width (cairo_surface_t *surface);
>
> So, in what way does Cairo modify the surface when I ask for its width?
>
> The same question applies to the other query methods of image surface. Is
> this just a badly written prototype? That is, is the following safe:
>
> auto w=cairo_image_surface_get_width(const_cast<cairo_surface_t*>(surface));
I don't know the full history, but my understanding is that many core
parts of the API were locked down pretty early on to avoid ABI
compatibility problems. Perhaps at that time the usefulness of
const'ing parameters was not held as a consensus of the developers at
that time.
Bryce
More information about the cairo
mailing list