我在哪里可以找到源头code向“真正”明白什么是标准功能在stdio.h做什么? [英] Where can I find source code to to 'truly' understand what the standard functions are doing in stdio.h?

查看:287
本文介绍了我在哪里可以找到源头code向“真正”明白什么是标准功能在stdio.h做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于对于新手,​​像我一样,有很大的难度与搜索的头文件,如stdio.h中像的getchar()的函数。不知怎的,我什么地方捡到一些信息,我不应该害怕时,找头文件中看到的东西是如何工作的。 (C ++的Primer Plus,斯蒂芬·普拉塔)

As a newb, like myself, to have great difficulty with searching the header files such as stdio.h for a function like getchar(). Somehow I picked up some information somewhere that I should not be afraid when looking in header files to "see how things work." (C++ Primer Plus, Stephen Prata)

我非常缺乏经验与头文件,至少可以说,和programmig一般。

I am very inexperienced with header files to say the least, and programmig in general.

在我试图找到的getchar()我发现stdio.h中简单的分支越来越多的头,和定位的getchar()成为increasinly复杂和耗时,而且我从来没有发现它。显然,我要对此都错了,我的意图仅仅是寻找一些来源$ C ​​$ C为我使用的功能。

In my attempt to find getchar() I found that stdio.h simply branches to more and more headers, and locating getchar() became increasinly complicated and time consuming, and I never found it. Clearly I am going about this all wrong, my intention was merely to find some source code for functions I am using.

所以我的问题是:我在哪里可以找到源头code到真正的'理解'什么标准功能是真的做

My question therefore is: Where can I find source code to truly 'understand' what the standard functions are 'really' doing?

推荐答案

如果你正在寻找的声明变量命令或其他使用注意事项,只是使用的在线参考

If you're looking for the declarations for variable order or other usage notes, just use an online reference or man.

如果你正在寻找的实际code,看看C标准库的实现,如GNU的的的libc

If you're looking for the actual code, look into an implementation of the C standard library, like GNU's libc.

值得注意虽然,实现并不简单,它们的依赖关系图去练舞。他们也往往在一个较低的水平与机器交互比我们大多数用于

It's worth noting though, that implementations are not simple, and their graph of dependencies goes far and wide. They also tend to interact with the machine on a lower level than most of us are used to.

考虑libc中的实现的的getchar

Consider libc's implementation of getchar:

int
getchar ()
{
  int result;
  _IO_acquire_lock (_IO_stdin);
  result = _IO_getc_unlocked (_IO_stdin);
  _IO_release_lock (_IO_stdin);
  return result;
} 

也许不是你期待。)

Probably not what you were expecting :).

(注:不知道如何很好的参考就是对C - 它只是一个我通常使用C ++)

(Note: No idea how good of reference that is for C -- it's just the one I typically use for C++.)

这篇关于我在哪里可以找到源头code向“真正”明白什么是标准功能在stdio.h做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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