3 ms·
Why does the spec mandate support for useless bad code instead of banning it?
by lonelappde 7y ago
Why does the spec mandate support for useless bad code instead of banning it?
- majewsky 7y ago1. Probably backwards-compatibility. 2. While you wouldn't write &*E by hand, it can easily arise from a macro expansion.
- Ericson2314 7y ago`E` is an lvalue --- a location that only becomes a load/store when it is converted to an rvalue or assigned to. `&` takes an lvalue and gives a pointer to that location, so `E` is eliminated without being converted to an rvalue or assigned to, so no harm done. The real question if why have "lvalues" at all. If assignment always had to have a pointer on the left hand: &a := ..., b := ... rather than: a = ..., , *b = ... then this problem goes away.