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]



Simon Burge writes:
> Iain Hibbert wrote:
> > constify dirname(3) and basename(3)
>
> Does this change have an SUSv3/Posix issues?  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?

Its a good question. I think it does not contradict the standard, in that you 
can still pass a modifiable string but it allows you also to pass a const 
string which was problematic before. (how prevalent was const when SUS/Posix 
was published?)

It could perhaps 'encourage' bad behaviour by software being written for the 
const version and this is actually why I noticed it - FreeBSD and OpenBSD have 
had this for many years and I found comms/obexapp needs an _UNCONST patch to 
build..

iain


Home | Main Index | Thread Index | Old Index