const/immutable member functions

Trass3r un at known.com
Mon Jan 24 11:57:46 PST 2011


> I wouldn't say that I *prefer* the current solution, but the current  
> solution is not so bad that I need it changed.
>
> It works fine, despite being confusing.  If it wasn't consistent with  
> the rest of the attributes, I'd say it was in need of changes, but it  
> fits within the scheme already outlined.
>
> I think we have more important problems to worry about than this.
>
> -Steve

I'm not sure either but I usually use the suffix version.
The question is if there is any case where the prefix one could be harmful  
(i.e. not resulting in an error message).
Maybe the following?:

class Foo
{
	private static Bar[] bar;

	// author thinks it returns a const pointer etc.
	const Foo* ptr()
	{
		return bar.ptr;
	}
}


More information about the Digitalmars-d mailing list