www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Does immutable(char)[] have any advantage over const(char)[] for

reply Trass3r <mrmocool gmx.de> writes:
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?
Jul 28 2009
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Tue, 28 Jul 2009 12:40:43 -0400, Trass3r <mrmocool 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
Jul 28 2009