This is the mail archive of the mailing list for the GCC 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: 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

> 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.

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