digitalmars.D - string-arguments of functions in 'std.file'
- CLXX (12/12) Feb 28 2009 dmd2.025, Windows
- Daniel Keep (8/25) Feb 28 2009 I... wait, what?
- torhu (3/27) Feb 28 2009 Hehe, someone had to little coffee today. 'in' implies const, and
- Daniel Keep (4/37) Feb 28 2009 *stares at it*
- Andrei Alexandrescu (4/21) Feb 28 2009 Yah, many of them are already changed in my tree. Phobos will have to
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.
Feb 28 2009
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? -- Daniel
Feb 28 2009
On 28.02.2009 15:47, Daniel Keep wrote:CLXX wrote:Hehe, someone had to little coffee today. 'in' implies const, and invariant is implicitly convertible to const. So Mr. 'CLXX' is right. :Pdmd2.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?
Feb 28 2009
torhu wrote:On 28.02.2009 15:47, Daniel Keep wrote:*stares at it* Well, that's what I get for posting at 2 AM. -- DanielCLXX wrote:Hehe, someone had to little coffee today. 'in' implies const, and invariant is implicitly convertible to const. So Mr. 'CLXX' is right. :Pdmd2.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?
Feb 28 2009
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.Yah, many of them are already changed in my tree. Phobos will have to sit this release out, though. Andrei
Feb 28 2009