const(FAQ)

janderson askme at me.com
Fri Mar 28 21:28:45 PDT 2008


Walter Bright wrote:
> The same questions about const come up repeatedly, so I decided that it 
> was past time to put up a FAQ dedicated to const. The initial version is 
> far from complete, but it's a start.
> 
> http://www.digitalmars.com/d/2.0/const-faq.html

I apologize if this was already suggested but that last section "Why 
aren't function parameters const by default" got me thinking.  What if 
you could surround code in a const block:

const
{
    //Anything in here gets const by default
	void foo(int* p) {}
};

Ok, this maybe something to add later when the current const is stable.

-Joel



More information about the Digitalmars-d mailing list