This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: PATCH: Declare memory allocation functions "throw()"
- From: Andrew_Pinski at PlayStation dot Sony dot Com
- To: mark at codesourcery dot com
- Cc: newlib at sources dot redhat dot com
- Date: Fri, 4 May 2007 11:28:42 -0700
- Subject: 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