Mail Archives: djgpp/2002/07/28/15:00:10
Hi. I am teaching myself C and C++ and was looking up the prototype of
a function in stdio.h and noticed that most of the functions had the
following prototype:
extern FILE *tmpfile (void) __THROW;
extern int fcloseall (void) __THROW;
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
__THROW;
*****what is this __THROW? ********
and in the following
extern int vdprintf (int __fd, __const char *__restrict __fmt,
_G_va_list __arg)
__THROW __attribute__ ((__format__ (__printf__, 2, 0)));
what is the __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
??
i am reading about c and c++ and have not yet totally figured out
exceptions.
i have read about
throw "overflow";
catch (const char * message) {cout<< "error : ! " << message <<endl;}
or more generally if there is a class such as
class Overflow {};
then i can have a line of code -
throw Overflow();
catch (Overflow) {
cout<< "overflow detected " <<endl; }
i just don't understand this g++ syntax of __THROW . where can I read
about it,
and how do I use it? {Is it an internal gnu thing that I shouldn't be
looking at or worrying about?}
Thank you very much!
I guess I am also puzzled by the syntax - what is the __THROW doing
after the
function call. i guess it makes sense sometimes to have something
after the function, for instance i have seen in a class::
{
int member_fn ( parameters ) const ;
}
where the const is modifying the unseen parameter "this" so we can use
member_fn () on const objects. what does this __THROW mean here? thank
you
very much! where can i read more to explain it- is it in stroudstrup?
is it a ansi c or c++ thing or a gnu thing?
Meshulum
- Raw text -