On 09/07/2011 09:30 AM, Jacob Carlborg 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
BTW, I think that using:
Mode.read | Mode.write
Instead of "rw" is the same thing as one should name variables with a
proper descriptive names instead of just "a" or "b".
I disagree: "rw" is quite obvious because you have context. It is not
Mode.read | Mode.write vs "rw"
but
File("filename.txt", Mode.read | Mode.write);
vs
File("filename.txt", "rw");