This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Using custom qualifiers like __THROW
- From: "Rupert Wood" <me at rupey dot net>
- To: <snodx at hotmail dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 17 Jul 2003 13:31:06 +0100
- Subject: RE: Using custom qualifiers like __THROW
snodx wrote:
> I was browsing the stdio.h file, on my Redhat 8.0 machine, when I
> came across the following line:
>
> extern int fcloseall(void) __THROW;
>
> Now I know about fcloseall(void) but I was perturbed to see the term
> __THROW. After studying a bit I came to know that it actually
> expands to the function throw()
throw() isn't a function - it's a C++ exception specification. It means,
loosely, "this function throws no C++ exceptions".
It's not quite that simple, though - it really means something along the
lines of redirect all exceptions not listed in the brackets to the
'unexpected()' function for reprocessing or program abort. Some people think
they're a good idea, others think they're bad because they add extra runtime
checks if you actually list exceptions in them. I've never really formed an
opinion.
> Terms like __THROW do not appear in stdio.h of other compilers like
> Borland or Turbo C++ compilers
Just to clarify - the header files don't belong to the compiler, they belong
to the OS's C library. In your case the header came from the glibc project -
so if you want to find out exactly why they've added this, they'll be the
ones to ask.