Re: Const correctness?

Bryce Harrington <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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
-- 
cairo mailing list
[email protected]
https://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.