On 2011-09-08 13:13, Steven Schveighoffer wrote:
On Wed, 07 Sep 2011 03:30:17 -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

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

It's not the same. "a" and "b" do not have any meaning, they are just
variable names. "r" stands for read and "w" stands for write. It's
pretty obvious that they do, especially in the context of opening a file.

I guess it's a little clearer in the context of opening a file. "a" can be short for "apple" and "b" can be short for "beer".

--
/Jacob Carlborg

Reply via email to