string-arguments of functions in 'std.file'

torhu no at spam.invalid
Sat Feb 28 07:14:14 PST 2009


On 28.02.2009 15:47, Daniel Keep wrote:
>
> CLXX wrote:
>>  dmd2.025, Windows
>>
>>  Some standard functions receive 'string' arguments.
>>  This is not a bug, but not good specs.
>>
>>  void[] read( in string name );
>>  void[] write( in string name, const void[] buffer );
>>  ....
>>
>>  They should be
>>
>>  void[] read( in char[] name );
>>  void[] write( in char[] name, const void[] buffer );
>>  ....
>>
>>  Former cannot receive char[]-arguments, and latter can.
>>  This change has backward compatibility.
>
> I... wait, what?
>
> *blinks*
>
> That change will just mean that the functions can't take string
> arguments, and if you WANT to pass a string, you have to heap-allocate a
> new one.
>
> Why don't you just pass a string?

Hehe, someone had to little coffee today.  'in' implies const, and 
invariant is implicitly convertible to const. So Mr. 'CLXX' is right. :P



More information about the Digitalmars-d mailing list