Use of __THROW in stdio.h

C

Chad

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
 
P

Peter Nilsson

Chad said:
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.
 
N

nelu

Chad said:
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.
 
R

Raymond Martineau

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

Chad

Raymond said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,217
Latest member
IRMNikole

Latest Threads

Top