Re: [AD] New WIP

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


In reply to Peter Puck (Peter Puck <zaqhaq@xxxxxxxxxx>):

[snip]
>I don't use const much myself but thinks it is two reasons for using it:
>       1. stricter type checking
>       2. better code generating
>The first is not a big problem but the second means that the code is
>seriously broken.

The `const' keyword should be used from a human point of view - that is
to say, when as far as we are concerned, we are not changing an object
in any way. Of course, it can be quite involved to figure out when an
object is/is not being changed by a function: for instance, when
locking/releasing bitmaps, are we changing them at all?

In this case, at least in the windows code, we are changing the bitmap
structure - firstly by changing its members (id and extra), and secondly
by changing its purpose: a locked bitmap has a different purpose than an
unlocked bitmap.

So, in this case, I would say that we should not declare the lock/unlock
functions as taking a const bitmap parameter.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/