This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Declare memory allocation functions "throw()"


newlib-owner@sourceware.org wrote on 05/04/2007 11:20:06 AM:
> This patch adds an empty exception specification (i.e., throw ()) to
> declarations of memory allocation functions in <stdlib.h>.
.....
> +/*  ISO C++.  */
> +
> +#ifdef __cplusplus
> +#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
> +#ifdef _HAVE_STD_CXX
> +#define _BEGIN_STD_C namespace std { extern "C" {
> +#define _END_STD_C  } }
> +#else
> +#define _BEGIN_STD_C extern "C" {
> +#define _END_STD_C  }
> +#endif
> +#define _NOTHROW throw()
> +#endif
> +#else
> +#define _BEGIN_STD_C
> +#define _END_STD_C
> +#define _NOTHROW
> +#endif

One suggestion, if we are using a new enough GCC (>=3.3), we can have 
_NOTHROW being defined as __attribute__((nothrow)) so we get the same 
benifit when people use -fexceptions in their C code.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]