This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
at all.

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.

-----Original Message-----
From: Florian Weimer [] 
Sent: Sunday, May 19, 2002 3:15 PM
To: Matthijs van Duin
Subject: Re: Why does this not compile?

Matthijs van Duin <> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]