Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: I think references should have been const by default
Date: Fri, 29 Oct 2021 06:32:56 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <86wnlwdkhj.fsf@linuxsc.com>
References: <87v91jzzgt.fsf@bsb.me.uk> <87y26f20kh.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="b7f56eff5ad6c7d9130605d054ce58ef"; logging-data="5278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Dp9DG9gS9qOheBmORYTLR5SVO/U5loY0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:tnd8N9AtjWSrp5m5WSXqj32ExKs= sha1:+86rXxBrRYfZdmxOBJqIBrIyQ9o=
Xref: csiph.com comp.lang.c++:82174
Juha Nieminen writes:
> Keith Thompson wrote:
>
>>> I tried it in C++ before posting (as I'd thought that "ABC" would have
>>> type const char*) but it seemed to work. (Using -Wall -std=c++14.)
>>
>> And you didn't bother to mention the diagnostic? I get
>> warning: ISO C++ forbids converting a string constant to ???char*??? [-Wwrite-strings]
>> And of course with "-pedantic-errors" it becomes a fatal error.
>
> If gcc (or whichever compiler this is) doesn't give an outright error from
> trying to assign a const pointer to a non-const one without an explicit
> cast, then it's non-standard-conforming [...]
I belive that statement is not correct. Can you cite a passage (or
passages) in the C++ standard that supports this assertion?