Does immutable(char)[] have any advantage over const(char)[] for function parameters?

Steven Schveighoffer schveiguy at yahoo.com
Tue Jul 28 10:30:37 PDT 2009


On Tue, 28 Jul 2009 12:40:43 -0400, Trass3r <mrmocool at gmx.de> wrote:

> I currently almost always use const(char)[] for function parameters to  
> make it possible to also pass char[] strings to the function.
>
> Are there any disadvantages like optimization issues?

The inability to use pure functions on those arguments.  Although, I'm not  
sure where the threading model is going, this might be an old requirement,  
since only shared data would arbitrarily change during a function call.

-Steve


More information about the Digitalmars-d-learn mailing list