Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: None <tech-toolchain@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 07/16/2003 15:30:02
> Secondly I read nothing in the above which implies in any way that
> the storage for the string constant used as an array initializer
> cannot ever be read-only.
Certainly. I never claimed they cannot be read-only.
Unfortunately for your argument, not all read-only storage has
const-qualified type.
> Note also that there is no distinction in Standard C (though there
> seems to be in GCC's implementation) between a definition in the form
> "char foo[]" and a definition in the form "char *foo".
This is true when - and ONLY when - foo is a formal parameter to a
function.
> When that initializer is a string constant then the storage for the
> array is const-qualified since the string constant may be read-only
Not all read-only storage has const-qualified type.
> All sources I've found are quite explicit in saying that an
> implementation _MAY_ use read-only storage for string constants
Yes.
> and as such they must _always_ be const-qualified.
No.
I don't know where you got this delusion that all read-only storage
must have a const-qualified type, but it doesn't agree with any other
reference I've ever found. What's more, it has nothing whatever to do
with adding const to a pointed-to type and then removing it later when
you know the original pointer was actually non-const, something you
seem convinced is verboten, but have never explained why.
Given those, I see no point in continuing the discussion.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B