------- Additional Comments From felix dot nawothnig at t-online dot de  
2004-12-05 19:10 -------
Diagnostics? Both files are 100% valid C++ - but since the C++ standard doesn't
enforce implementation of references as pointers they cause ABI-defined (?)
behaviour at/after linkage, just as...

extern int x;
void main() { foo(); assert(x == 5); }
---
float x;
void foo() { x = 5; }

...isn't guaranteed to "work" either. (but is still valid C)

Reading the reference over a pointer would still work because we can't remove
the reference itself from the object since someone might do "extern int &y;" in
another file - but it's evil. (non-portable)

*And* they are guaranteed to be const by the standard.

So, yes, safe to optimize. I think. :)

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18842

Reply via email to