Error ifndef _REENTRANT?

M

Michael B Allen

Does _REENTRANT mean that all of your code has to be reentrant? If I do:

#if __USE_UNIX98
mbstate_t mb;
...
mbrtowc(..., &mb)
#else
mbtowc(...)
#endif

Should I stick a #ifndef _REENTRANT error in there if the reentrant
version of mbrtowc isn't available? I don't know in advance that this
function will be called by multiple threads. What would you do in this
case?

Mike
 
M

Michael B Allen

Maybe. _REENTRANT isn't part of C.

Holy mackerel, I think you're right. I guess it's just another one of
those unwritten rules. Obviously a lot of stuff would break miserably
if standard library functions really weren't reentrant.

Yuck,
Mike
 
P

pete

Michael said:
Holy mackerel, I think you're right. I guess it's just another one of
those unwritten rules. Obviously a lot of stuff would break miserably
if standard library functions really weren't reentrant.

Standard library functions really aren't reentrant.

N869
7.1.4 Use of library functions
[#4] The functions in the standard library are not
guaranteed to be reentrant and may modify objects with
static storage duration.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top