Discussion Thread: DIP 1035-- at system Variables--Final Review

Paul Backus snarwin at gmail.com
Wed Feb 23 22:54:53 UTC 2022


On Wednesday, 23 February 2022 at 22:01:55 UTC, Stanislav Blinov 
wrote:
>
> Because not all possible values of `data.length` are valid 
> values for `write`'s third argument.

POSIX says:

> Before any action described below is taken, and if nbyte is 
> zero and the file is a regular file, the write() function may 
> detect and return errors as described below. In the absence of 
> errors, or if error detection is not performed, the write() 
> function shall return zero and have no other results. If nbyte 
> is zero and the file is not a regular file, the results are 
> unspecified.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html

I was unable to find a definition in the standard itself of 
exactly what "unspecified" means in this context, but I think we 
can assume that it does not mean the same thing as "undefined", 
because the POSIX standard uses the actual word "undefined" 
elsewhere (e.g., in the description of 
[`pthread_mutex_destroy`][1]).

If we assume that it means the same thing as ["unspecified 
behavior" in C][2], then it means that there are multiple 
possible behaviors, and the standard does not require an 
implementation to commit to any particular one in any given 
situation.

[1]: 
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_destroy.html
[2]: http://port70.net/~nsz/c/c99/n1256.html#3.4.4


More information about the Digitalmars-d mailing list