delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/28/15:00:10

From: mlaks2000 AT yahoo DOT com (Mitchell Laks)
Newsgroups: comp.os.msdos.djgpp
Subject: newbie Q: meaning of __THROW in stdio.h?
Date: 28 Jul 2002 11:48:24 -0700
Organization: http://groups.google.com/
Lines: 56
Message-ID: <ab3b13db.0207281048.702e0c80@posting.google.com>
NNTP-Posting-Host: 162.83.182.28
X-Trace: posting.google.com 1027882104 12684 127.0.0.1 (28 Jul 2002 18:48:24 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 28 Jul 2002 18:48:24 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019