tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: constify dirname/basename [was: CVS commit: src]

> SUSv3 says that both functions "may modify the string pointed to by
> path" (the argument to those functions).  While our implementations
> don't do that, are we OK by the standards to now declare those
> functions as having a const argument?

I can't see why not.

(1) Constifying the argument does not forbid (FVO "forbid" which are
really "give a warning for") any calls conforming to the spec.

(2) Even if it did, implementations are allowed to warn about anything
they please, including perfectly valid code.

The only issue I can see is the one already raised, that it encourages
(FSVO "encourage") passing consted strings as arguments.  I'm not sure
whether I think this is a problem.  I'm moderately sure it isn't an
SUSv3 or POSIX violation, though.

/~\ The ASCII                           der Mouse
\ / Ribbon Campaign
 X  Against HTML     
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index