lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Feb 2007 16:05:01 +0200
From:	Avi Kivity <avi@...o.co.il>
To:	Francis Moreau <francis.moro@...il.com>
CC:	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: Re: memparse(), simple_strtoul() prototypes...

Francis Moreau wrote:
>> > unsigned long simple_strtoul(const char *cp, char **endp,unsigned 
>> int base)
>
> hm, I don't get your point. I understand why we cast 'cp' into a (char
> *) but that's not my point. My point is why aren't all function
> parameters are not const ?
>

'cp' can be passed as const, because simple_strtoul() does not modify 
it. 'endp' cannot be passed as const, because simple_strtoul() cannot 
know whether the caller would want to modify the string or not.

Whichever way it is written, it is broken.  If changed to 'const', it 
would preclude the caller from modifying the string if one has a 
non-const string.  As written, it can silently convert a const string to 
a non-const string.  However, as written it is (a) standard conforming, 
and (b) more useful.

-- 
error compiling committee.c: too many arguments to function

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists