From owner-cvs-all Fri Jan 29 11:52:47 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA02147 for cvs-all-outgoing; Fri, 29 Jan 1999 11:52:47 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA02134; Fri, 29 Jan 1999 11:52:45 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.2/8.9.1) id LAA80774; Fri, 29 Jan 1999 11:52:38 -0800 (PST) (envelope-from dillon) Date: Fri, 29 Jan 1999 11:52:38 -0800 (PST) From: Matthew Dillon Message-Id: <199901291952.LAA80774@apollo.backplane.com> To: Bruce Evans Cc: brian@Awfulhak.org, cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG Subject: Re: cvs commit: src/sys/sys kernel.h References: <199901291349.AAA06463@godzilla.zeta.org.au> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk : :You can do that anyway by casting away the const. Don't do that. : :>The prototype is doubly wrong because there's no correct way to write :>the function - not without casting the const char * to a char *. : :There is no problem with implementing strchr(), only a minor problem :with its use. Casting the const char * to char * is a correct way of :implementing it. : :A similar problem with the strtoul() family was "fixed" by breaking :the kernel versions to take a `const char **endptr' instead of a :`char *endptr' and propagating the breakage to all callers. This :should be backed out. The warning can be avoided using a union hack. : :Bruce This is a good example of how const propogation can break down. The real solution, at least for the kernel, is to leave the function as-is but possibly rename it, or provide two functions: one that is passed and returns a const char *, and on that doesn't. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message