Boost logo

Boost :

From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-08-15 13:40:31


> -----Original Message-----
> From: Peter Dimov [mailto:pdimov_at_[hidden]]
> Sent: Thursday, August 15, 2002 7:13 PM
> To: Boost List
> Subject: [boost] std::exception problems on Borland with -ps
>
>
> On Borland, <exception> defines std::exception::what() (among
> other things)
> as having C calling convention, regardless of the default
> (specified on the
> command line.)
>
> When code tries to derive from std::exception
> (boost::use_count_is_zero is
> an example), it defines ::what() with the default calling
> convention, and
> the compiler issues an error when the default is, for
> example, stdcall (-ps)
> and not C (-pc).

Wouldn't it be simpler to define what() as follows explicitly, instead of surrounding the class with push/pop?

#define BOOST_EXCEPTION_WHAT_CALLING_CONVENTION __cdecl

...

class some_derived_exception : public std::exception
{
virtual const char* BOOST_EXCEPTION_WHAT_CALLING_CONVENTION what();
};

This seems like a bug in Borland. When virtual is specified for a class member function, and the calling convention is not specified for a derived override of the virtual function, the calling convention of the original should be used (and if a calling convention is specified explicitly, a warning should be issued). The destructor of exception is also virtual. How does the destructor get defined if you do what you do (compile with -ps, and do push/pop to get a C calling convention)?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk