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. -SteveBut "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
