Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use of __THROW in stdio.h

1 view
Skip to first unread message

Chad

unread,
Jan 3, 2006, 10:02:01 PM1/3/06
to
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

unread,
Jan 3, 2006, 10:15:35 PM1/3/06
to
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

unread,
Jan 3, 2006, 10:20:29 PM1/3/06
to

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

unread,
Jan 3, 2006, 10:26:06 PM1/3/06
to
On 3 Jan 2006 19:02:01 -0800, "Chad" <cda...@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

unread,
Jan 3, 2006, 10:31:30 PM1/3/06
to

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

Chad

0 new messages