[m-dev.] diff: fix boehmgc problem with MSVC
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Oct 2 15:25:46 AEDT 2000
On 29-Sep-2000, Peter Ross <peter.ross at miscrit.be> wrote:
>
> Estimated hours taken: 0.25
>
> Avoid the MSVC compiler error:
> gc_cpp.CPP(52) : error C2084: function 'void *__cdecl operator
> new[](unsigned int)' already has a body
Which version of MSVC does that occur with?
This duplicated definition error seems to be due to the definition
of `operator new[](size_t)' in both gc_cpp.h and in gc_cpp.c.
The comments in gc_cpp.h say that the inline definition there is
needed for VC++ 6. Probably your fix of disabling the definition
in gc_cpp.c is right, but it would be interesting to know which
VC++ version you are using.
> boehgc/gc_cpp.cc:
> Don't include above definition if we are using MSVC compiler.
>
> Index: gc_cpp.cc
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/boehm_gc/gc_cpp.cc,v
> retrieving revision 1.1.1.2
> retrieving revision 1.2
> diff -u -u -r1.1.1.2 -r1.2
> --- gc_cpp.cc 1999/07/14 23:47:08 1.1.1.2
> +++ gc_cpp.cc 2000/09/29 10:48:31 1.2
> @@ -48,6 +48,7 @@
> #endif
>
> #ifdef OPERATOR_NEW_ARRAY
> +# ifdef _MSC_VER
>
> void* operator new[]( size_t size ) {
> return GC_MALLOC_UNCOLLECTABLE( size );}
> @@ -55,6 +56,7 @@
> void operator delete[]( void* obj ) {
> GC_FREE( obj );}
>
> +# endif
> #endif /* OPERATOR_NEW_ARRAY */
The `#endif' that you've added is not in the right spot -- you've
disabled the definition of `operator delete[]' too, which isn't right.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list