strange compiler error

Ali Çehreli acehreli at yahoo.com
Wed Feb 27 12:51:17 PST 2013


On 02/27/2013 11:58 AM, Michael wrote:

 > enum FnType : ubyte { Unknown, Constructor, Function, GlobalFunction }
 >
 > Tuple!(string[], FnType) parse(string source)
 > {
 > return tuple(new string[2], FnType.Unknown);
 > }

Sorry, this doesn't answer your question but in general, if you are not 
going to pass the parameter to another function that requires a 
'string', then it is better to define that function parameter as 'const 
char[]':

Tuple!(string[], FnType) parse(const char[] source)
{
     // ...
}

That way you wouldn't need to call .idup on a mutable argument.

Ali



More information about the Digitalmars-d mailing list