in reply to Re: Changing path to home directory
in thread Changing path to home directory

If neither is set, chdir does nothing. It returns true on success, false otherwise;

So .... if it's supposed to do nothing, and successfully does nothing, shouldn't it then return true ?
Seems to me AppleFritter has correctly identified that, under those conditions, chdir() returns false - but it's not spelled out very clearly in the documentation.

I think the documentation would be better written as:
"If neither is set, chdir does nothing and returns false. Otherwise it returns true on success, or false on failure"


Cheers,
Rob

Replies are listed 'Best First'.
Re^3: Changing path to home directory
by cheako (Beadle) on Mar 05, 2015 at 04:36 UTC
    The "Otherwise it returns true on success, or false on failure." is implied or at least you could write that about any function. What the documentation should indicate is when failure(s) can be encountered. In this case I think what needs to be indicated is the return code is translated(y/01/10/) and passed from the underlying system call.
    When a statement is always true, except for when it's false, the cases when the statement is false _need_ to be documented. -- Mike Mestnik