On Tue, Nov 5, 2013 at 2:12 PM, Jeff Law <l...@redhat.com> wrote: > > I can't speak for Andrew, but my experience with this kind of object type > casting in a large C++ project is that it's a red flag for a design problem.
I'm going to chime in to say that I think it's a pretty typical way to represent a compiler IR in C++. There is a base type that a lot of code uses, but there is also a real type, and the way to get to that real type is to use a cast. We could do it all with virtual functions, but those carry a different cost. In effect, using virtual functions increases the size of the code field from 16 bits to 64 bits. It adds up. Also this seems to be a pretty direct version of the data structures we already have. Ian