This is the mail archive of the
mailing list for the GCC project.
RE: Why does this not compile?
- From: "Harron, Vince" <vharron at soe dot sony dot com>
- To: 'Florian Weimer' <fw at deneb dot enyo dot de>, Matthijs van Duin <gcc at nubz dot org>
- Cc: gcc at gcc dot gnu dot org, "Harron, Vince" <vharron at soe dot sony dot com>, aoliva at redhat dot com
- Date: Sun, 19 May 2002 15:26:17 -0700
- Subject: RE: Why does this not compile?
Thanks for the suggestion, Matthijs. Actually, I try to use const whenever
it makes sense. It just hadn't occurred to me in this case because,
conceptually, I am modifying the "binary" object, which is in turn modifying
the reference. But, of course, no fields in the binary object are modified
Either way, I'm having trouble imagining why the spec forbids this in the
first place. So what if I modify a temporary? Any ideas?
BTW guys, thanks for your responses.
From: Florian Weimer [mailto:firstname.lastname@example.org]
Sent: Sunday, May 19, 2002 3:15 PM
To: Matthijs van Duin
Cc: email@example.com; firstname.lastname@example.org; email@example.com
Subject: Re: Why does this not compile?
Matthijs van Duin <firstname.lastname@example.org> writes:
> it's funny, when I see code of fellow students or even teachers, it
> seems that hardly anyone bothers to use const-qualifiers, or
> qualifiers in general
During my C++ days, I've repeatedly read rules of thumb like "const creates
constant confusion", referring to poisonous aspect of const (once you add it
somewhere, you have to add it in many places). Maybe that feeling carries
over to the pass-by-reference-to-constant-object
case, which is rather unwarranted, of course.