Article View: comp.std.c
Article #223Re: const T **
From: Paul Eggert
Date: Wed, 15 Apr 1992 18:02
Date: Wed, 15 Apr 1992 18:02
20 lines
1257 bytes
1257 bytes
jfw@ksr.com (John F. Woods) writes:
>Losing the compile-time diagnostic is regrettable,
>but note that there is no diagnostic required by the following:
> #include <string.h>
> *strchr("hammer me", ' ') = 0;
But this argument uses one botch in the C definition to justify another
proposed botch. If C had C++-style overloaded functions (or better
yet, polymorphic functions), there would be no problem, because there
could be two versions of strchr:
char *strchr(char *, int);
char const *strchr(char const *, int);
and the above error would be caught at compile-time (assuming string
constants were changed to be of type char const *, not char *). Since
C lacks such features, it must botch strchr's declaration; but that's no
excuse for also botching the semantics of pointer assignment.
Technical Details
Message-ID:
<#+x^dlyoi@twinsun.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!swrinde!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggertReferences:
<1611@imec.UUCP> <11434@ksr.com> <#+x+b8wen@twinsun.com> <11457@ksr.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!swrinde!elroy.jpl.nasa.gov!ucla-cs!twinsun!eggert From: eggert@twinsun.com (Paul Eggert) Newsgroups: comp.std.c Subject: Re: const T ** Keywords: const Message-ID: <#+x^dlyoi@twinsun.com> Date: 15 Apr 92 18:02:01 GMT References: <1611@imec.UUCP> <11434@ksr.com> <#+x+b8wen@twinsun.com> <11457@ksr.com> Sender: usenet@twinsun.com Organization: Twin Sun, Inc Lines: 20 Nntp-Posting-Host: bi