Search code examples
cioc99

What is an equivalent of 'unlocked' I/O functions in C99?


When I use --std=c99 GCC defines __STRICT_ANSI__ and when it is on, the BSD and System V features don't kick in. It implies __USE_MISC and __USE_POSIX are left undefined.

-- stdio.h --
...
#if defined __USE_POSIX || defined __USE_MISC
extern int getc_unlocked (FILE *__stream);
extern int getchar_unlocked (void);
#endif /* Use POSIX or MISC.  */
...

In the result, functions that I would like to use are omitted. My question is how can I realize I/O operations on standard streams in C99 but without locking ?


Solution

  • Use -std=gnu99 instead of -std=c99 and it will work the way you want.