This is the mail archive of the gcc@gcc.gnu.org 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: Really, really const


Gabriel Dos Reis writes:
 > Andrew Haley <aph@redhat.com> writes:
 > 
 > | Gabriel Dos Reis writes:
 > |  > 
 > |  > 
 > |  > just a comment; I don't know what the is. But
 > |  > 
 > |  > [...]
 > |  > 
 > |  > | The memory a[0] is read twice.  Is there any attrribute I can use to
 > |  > | stop gcc from doing this?
 > |  > 
 > |  > GCC should be able to get that right without resorting to attributte
 > |  > hackery. 
 > | 
 > | I think the C standard says that gcc has to read the memory twice.
 > 
 > Which part says that?
 > 
 > In C++, the object a (and its subobjects [ai]) certainly are const
 > everywhere. 

Ah, okay.  I think you're right.  I thought that it was legal to
declare an object to be const-qualified in one translation unit but
not in another.  Looking at 6.5.3, "Type qualifiers", that doesn't
seem to be the case.

So, I wonder why gcc reads the memory twice.

Andrew.


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