On 09/08/2011 03:05 PM, Jacob Carlborg wrote:
On 2011-09-08 13:04, Steven Schveighoffer wrote:
On Wed, 07 Sep 2011 03:27:43 -0400, Jacob Carlborg <[email protected]> wrote:

On 2011-09-06 19:39, Steven Schveighoffer wrote:

I like enums in terms of writing code that processes them, but in terms
of calling functions with them, I mean look at a sample fstream
constructor in C++:

fstream ifs("filename.txt", ios_base::in | ios_base::out);

vs.

File("filename.txt", "r+"); // or "rw"

There's just no way you can think "rw" is less descriptive or
understandable than ios_base::in | ios_base::out.

-Steve

But "r+" is. And that's what I assume will be used when I see a file
opening function taking a string "mode" parameter. But if you say that
"rw" can/will be used instead than that's better.


Yes, I'll try to add "rw" and maybe some other letter combinations that
make sense in my next version.

But I think we still have to support "r+", even though it's esoteric,
because too much existing code already does this, and to not support it
would leave silently compiling bugs.

-Steve

Didn't you just say that you would check the string at compile time?


That is not compatible with the auto f = File(name, mode); interface.



Reply via email to