>> It's not a big deal but it is a bit confusing to see these modes in
>> the code. Is there some platform where the mode arg is used in this
>> situation?
>K&R2 documents a non-variadic prototype for open. There were probably
>platforms that actually used that declaration at that time.
If open(2) were being spec'd today, they probably would not make it
variadic. That seems like a relic from the days of 110 baud
teletypes, where literally every extra character typed was something
to be avoided if possible.
They would probably document it as:
arg3 (mode): Used only if file is being created; pass as 0 otherwise.
Going further afield, I would argue that the whole idea of having a mode
arg at all is wrong. It's kind of an accident of history that it worked
out the way it did, and the fact that the third arg is usually passed as
0666 (0777 when creating an executable) is testament to this. It should
all just be controlled by "umask".
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
When responding to my posts, please try to refrain from giving bureaucratic
answers.
If you have nothing useful to say, then just click Next and go on.