any news on const/invariant?

Derek Parnell derek at nomail.afraid.org
Mon Nov 26 22:37:27 PST 2007


On Mon, 26 Nov 2007 21:24:13 -0800, Walter Bright wrote:

> I'm not sure why one would need protection against changing the bitmap 
> pointer. GammaAdjust should just take a byte[], not a ref byte[].

 byte[] bitmap;
 bitmap = LoadBitMapFromFile("worldroadmap.bmp");
 GammaAdjust(bitmap, 0.20);
 Render(device, bitmap);

If the 'GammaAdjust' routine changed the pointer then 'Render' routine
would not display the adjusted bitmap. 

So I would like to tell the compiler that 'GammaAdjust' is not allowed to
change the pointer and thus if (at compile time) it does so the compiler
should tell me of the error.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
27/11/2007 5:28:39 PM



More information about the Digitalmars-d mailing list