__isoc99_scanf and scanf

I studied various compiler options in GCC and watched the changes as I made changes to the standard used.

$ gcc Q1.c -Wall -save-temps -o Q1 $ vi Q1.s 

I see one of the operation codes as

  call __isoc99_scanf 

and now that I am compiling C89 standards

 $gcc Q1.c -Wall -save-temps -std=c89 -o Q1 $ vi Q1.s 

I see the opcode as

 call scanf 

What is the difference between these two forms of scanf ? Any link in which I can see their source would be highly appreciated.

+7
source share
2 answers

The reason is strict adherence to c99, which prohibits some existing GNU extension conversion specifications.

In glibc 2.17, in libio/stdio.h there is this comment:

 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ GNU extension which conflicts with valid %a followed by letter s, S or [. */ extern int __REDIRECT (fscanf, (FILE *__restrict __stream, const char *__restrict __format, ...), __isoc99_fscanf) __wur; extern int __REDIRECT (scanf, (const char *__restrict __format, ...), __isoc99_scanf) __wur; extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, const char *__restrict __format, ...), __isoc99_sscanf); 
+8
source

scanf (3) manual mentions several type modifiers introduced in c99:

 j As for h, but the next pointer is a pointer to an intmax_t or a uintmax_t. This modifier was introduced in C99 t As for h, but the next pointer is a pointer to a ptrdiff_t. This modifier was introduced in C99. z As for h, but the next pointer is a pointer to a size_t. This modifier was introduced in C99. a (C99) Equivalent to f 
+6
source

All Articles