Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Use of __THROW in stdio.h (http://www.velocityreviews.com/forums/t440748-use-of-__throw-in-stdio-h.html)

Chad 01-04-2006 03:02 AM

Use of __THROW in stdio.h
 
What purpose does __THROW serve in stdio.h. For example, in I see stuff
like the following in stdio.h:

/* Generate a temporary filename. */
extern char *tmpnam (char *__s) __THROW;
__END_NAMESPACE_STD

#ifdef __USE_MISC
/* This is the reentrant variant of `tmpnam'. The only difference is
that it does not allow S to be NULL. */
extern char *tmpnam_r (char *__s) __THROW;
#endif

I understand the include guards and that extern declares (but not
defines) a variable. I just am drawing a blank on what __THROW. Can
someone please enlighten me on this?

Thanks in advance
Chad


Peter Nilsson 01-04-2006 03:15 AM

Re: Use of __THROW in stdio.h
 
Chad wrote:
> What purpose does __THROW serve in stdio.h.


Ask the person who wrote it. It's not something specified by the C
standard beyond the fact that identifiers that begin with double
underscores are reserved for the implementation for whatever use
it likes.

> For example, in I see stuff
> like the following in stdio.h:
> ...


That may be what is in _your_ implementation's <stdio.h>, but it
is not required to be in anyone else's. Indeed, there is no requirement
that a file called stdio.h even exist.

Comp.lang.c doesn't deal with underlying implementation specifics. It
only
deals with what the minimal C language definition and the C virtual
machine.

I suggest you try a newsgroup dedicated to your implementation.

--
Peter


nelu 01-04-2006 03:20 AM

Re: Use of __THROW in stdio.h
 

Chad wrote:
> What purpose does __THROW serve in stdio.h. For example, in I see stuff
> like the following in stdio.h:
>
> /* Generate a temporary filename. */
> extern char *tmpnam (char *__s) __THROW;
> __END_NAMESPACE_STD
>
> #ifdef __USE_MISC
> /* This is the reentrant variant of `tmpnam'. The only difference is
> that it does not allow S to be NULL. */
> extern char *tmpnam_r (char *__s) __THROW;
> #endif
>
> I understand the include guards and that extern declares (but not
> defines) a variable. I just am drawing a blank on what __THROW. Can
> someone please enlighten me on this?


I checked mingw's stdio.h and there's no __THROW. My Linux box has it.
I think it's related to implementing ISO C stdio on top on C++
iostreams but I'm not sure so you should probably wait for someone else
to answer the question.


Raymond Martineau 01-04-2006 03:26 AM

Re: Use of __THROW in stdio.h
 
On 3 Jan 2006 19:02:01 -0800, "Chad" <cdalten@gmail.com> wrote:

>What purpose does __THROW serve in stdio.h. For example, in I see stuff
>like the following in stdio.h:
>
>/* Generate a temporary filename. */
>extern char *tmpnam (char *__s) __THROW;
>__END_NAMESPACE_STD


This is a system-specific issue, and does not apply to C.

For reference, __THROW is meant to declare the function as capable of
throwing exceptions (a C++ feature). In C, the macro does nothing.


Chad 01-04-2006 03:31 AM

Re: Use of __THROW in stdio.h
 

Raymond Martineau wrote:
> On 3 Jan 2006 19:02:01 -0800, "Chad" <cdalten@gmail.com> wrote:
>
> >What purpose does __THROW serve in stdio.h. For example, in I see stuff
> >like the following in stdio.h:
> >
> >/* Generate a temporary filename. */
> >extern char *tmpnam (char *__s) __THROW;
> >__END_NAMESPACE_STD

>
> This is a system-specific issue, and does not apply to C.
>
> For reference, __THROW is meant to declare the function as capable of
> throwing exceptions (a C++ feature). In C, the macro does nothing.


Okay. Thanks. I wasn't aware _THROW was system-specific.

Chad



All times are GMT. The time now is 09:28 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57