__isoc99_scanf和scanf [英] __isoc99_scanf and scanf

查看:228
本文介绍了__isoc99_scanf和scanf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究GCC中的各种编译器选项,并在更改要使用的标准时观察到了更改.

I was studying various compiler option in GCC and observing changes when I made changes in the standard to be used.

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

我将其中一个操作码视为

I see one of the opcodes as

 call    __isoc99_scanf

现在我使用C89标准进行编译

and now when I compile with the C89 standards

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

我看到操作码为

call    scanf

这两种形式的scanf有什么区别?我能看到其来源的任何链接都将受到高度赞赏.

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

推荐答案

严格遵循c99的原因不允许使用某些现有的GNU扩展转换说明符.

The reason is strict following of c99 disallow some existing GNU extension conversion specifiers.

在glibc 2.17中,在libio/stdio.h中有以下注释:

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);

这篇关于__isoc99_scanf和scanf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆