Const sucks

Gregor Richards Richards at codu.org
Mon Sep 10 12:55:29 PDT 2007


Derek Parnell wrote:
>> o  const and invariant now mean "fully const" and "fully invariant", 
>> where fully means "head and tail combined":
> 
> Remind me again what the difference between 'const' and 'invariant' is.

const: I promise not to change this, but acknowledge that somebody else 
might.

invariant: Neither I nor anyone else will change this.

const has a more limited use for optimization than invariant, since the 
value could be changed by other threads/programs-with-shm/whatever from 
under you.

  - Gregor Richards

PS: Or at least, this is my understanding :)



More information about the Digitalmars-d mailing list