On 28 Jul 2008, at 02:39, Tim Moore wrote:

> I'm not sure what's going on in your example, as foo needs to be  
> defined
> somewhere in order for wibble to inherit from it. Otherwise there's  
> serious bug
> there.
>> If we're requiring a never MSVC than that, I believe we're fine. And
>> perhaps you meant something else entirely?
> I'm comfortable saying that we need a more recent compiler than MSVC  
> 6.

Sorry, I probably reduced it down too much for brevity. Essentially it  
says 'if you forward declare a base class, when using it in an  
auto_ptr, then MSVC might not run a derived class' virtual dtor' - the  
fix was to include the header file for the base class, so MSVC 'saw'  
the explicit virtual dtor on the base, and generated a real destructor  
call. If you're happy that everyone is using a modern MSVC, fine. Also  
I suspect osg:::ref_ptr doesn't have this issue, because the base  
class (osg::Referenced) is visible to the osg::ref_ptr template.

As a test, I tried (last night) doing this reduction on Aircraft/ 
aircraft.hxx and Aircraft/controls.hxx.

The resulting patch is quite interesting - firstly both header files  
went from including others to pulling in either no 'real' headers (in  
the case of aircraft) or one (SGSubsystemMgr, for the base class) in  
the case of controls.hxx.

The interest comes in what I had to 'fix' to then build - explicitly  
including controls.hxx or FDM/flight.hxx since aircraft.hxx didn't  
drag it in, fine. But I had to add fg_init.hxx includes to a couple of  
files, <iostream> to some others, and <simgear/structure/ 
exception.hxx> to another.

So, this is probably something I'll pursue, at a background level.  
Picking one header, cleaning it out, and fixing the resulting breakage  
is a pretty manageable chunk of work, but there's a few to do. As I go  
I'll remove any #ifndef cplusplus nonsense and fix up C standard  
library includes. I'd like to collect a list of known beneficial (and  
worthwhile) improvements, so far it's:

  - ensure source files include config.h
  - ensure header files don't include config.h
  - remove pointless cplusplus guards
  - replace C-standard library includes with C++ wrappers
  - replace includes with forward class declarations where possible  
(in headers)
  - remove 'using std::foo' (or indeed an use of 'using') in header  
files
  - suggestions?
  - objections?

I'll stay away from the FDM source, since my feeling is they're either  
external (JSBsim, UIUC) or more holistic chunks (yasim) than other  
parts of the code.

Regards
James

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to