Compiler Bug, or Not?
I'm a firmware engineer. We use C++ for our firmware. C++ has been disparaged by some great programmers, but they are also the ones who talk about how great Ruby and JavaScript are. Try writing real-time firmware with those! But I digress. Yesterday I had an interesting experience with a bug that took me far to long to find (the fix was easy). Let me see if I can explain this well enough to get some helpful feedback from the C++ geniuses that I know are lurking out there. I added a new class to our firmware a couple days ago, and had it instantiated inside another class. The two classes can be simplified to look something like this: class Bar { public: Bar(); void initialize(); private: int x; }; class Foo { public: Foo(); void start(); private: Bar * bar; }; Not exactly like that, but close. Firmware isn't very complicated, right? So anyway, here are the implementations for each, roughly: Foo::Foo() { Bar * bar = new Bar();...