%% Richard Levitte - VMS Whacker <[EMAIL PROTECTED]> writes:
rl> From: "Paul D. Smith" <[EMAIL PROTECTED]>
psmith> This is similar to standard C functions which take a const
psmith> char*, for example, and return a char* that points into the
psmith> string.
rl> Like strstr()...
Yep. Plus strchr(), strrchr(), and strpbrk(), at least.
psmith> IMHO this is a legitimate reason to cast away const, and that
psmith> the "const" notation on the arguments to lhash is useful for
psmith> self-documentation purposes, at the least.
rl> Hmm, perhaps you're right. I'm just a bit worried about how hard it
rl> might become if someone is stupid enough to actually use the returned
rl> (non-const) pointer to change something that is on RO memory...
Could be an issue, but remember that the function simply returns a point
to memory it was passed. So the only way to get into this situation is
to pass RO memory to the function in the first place, then "forget" and
use the returned value as if it were RW.
"const" isn't perfect by a long shot, but I prefer to leave these little
loopholes lying around and do the best we can WRT getting the prototypes
correct. "Knowing" that your data won't be modified by the function
you're invoking because the argument is const is, IMO, a valuable thing.
YMMV.
(I realize that "knowing" requires that you trust the implementor, but
we're all trustworthy here, right? :)
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> HASMAT--HA Software Methods & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]