[ODE] Re: Latest Code and MsVC

Ruud van Gaal ruud at marketgraph.nl
Thu Dec 6 04:07:01 2001


> Yep getting those same errors, also the lack of alloca.h 
> under MSVC will =
> need a small mod to some files that include it. I get an 
> error on the =
> D_ALL_PARAM_NAMES(0,) as its missing an arg.

Looks very much compiler-specific, accepting an empty arg.
Actually, the v0.25 code (the only one I still have) include malloc.h, which
is ok on Windows (I needed to #include alloca.h on the SGI's). I propose an
<ode/alloc.h> which deals with selecting the right include files based on
platform #define's in one file.

For SGI IRIX, this will do:
#ifdef __sgi
#include <alloca.h>
#endif

Furthermore, I got it to compile with MSVC++7 (beta) without problems it
seems, but with VC6 I get:

Q:\src\libs\ode\ode.cpp(312) : warning C4291: 'void *__cdecl dBase::operator
new(unsigned int)' : no matching operator delete found; memory will not be
freed if initialization throws an exception
        Q:\src\libs\ode\objects.h(39) : see declaration of 'new'

Although objects.h (in v0.25) declares new and delete, MSVC6 really handles
new and delete overloading in a non-standard, backward compatible way. MSVC7
corrects this. I've had some long threads about this on Usenet (in one of
the Microsoft groups I think). delete[] doesn't really exist on MSVC6; it
never calls the destructors, IIRC. It is implemented as 'free(p)'. :)

So I don't mind the memory leak as long as I know that MSVC7 will fix this,
the only question is how often dBase derived classes are allocated (so the
memory leak can potentially be too large).

BTW I just created a project (.dsp) for MSVC6, instead of going through a
makefile.

Ruud
PS Chris, please turn off your HTML posting, it's really cluttering here.