From: Dan P. <ba...@al...> - 2005-12-22 17:55:56
|
On Dec 22, 2005, at 4:46 AM, Sam Steele wrote: > Here's the exact warning: > > Tiki.framework/PrivateHeaders/hid.h: In constructor > 'Tiki::Hid::Event::Event()': > Tiki.framework/PrivateHeaders/hid.h:126: warning: > 'Tiki::Hid::Event::port' will be initialized after > Tiki.framework/PrivateHeaders/hid.h:120: warning: 'int > Tiki::Hid::Event::key' > Tiki.framework/PrivateHeaders/hid.h:113: warning: when > initialized here Interesting. I actually just heard about this from someone at work the other day for the first time: if you do the initialization lists in a constructor, it will execute them in the order they appear in the class, not the order specified on the constructor. Which seems incredibly stupid to me. But whatever, I'm not the C++ designer. :) Since I learned that I've switched to using pretty much exclusively in-function initialization unless it's not possible (e.g. references). The init lists just seem deceptive and confusing to me now. At least GCC does warn about it, though that particular warning seems kinda useless since port and key don't depend on each other... |