Where is ptrdiff_t defined in C?

邮差的信 提交于 2019-12-03 08:04:22

问题


Where is ptrdiff_t defined in C? If non-trivial, how can I make this type visible from GCC on Linux?


回答1:


It's defined in stddef.h.


That header defines the integral types size_t, ptrdiff_t, and wchar_t, the functional macro offsetof, and the constant macro NULL.




回答2:


It is defined by the POSIX standard: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html Where the type is exactly may be implemetation-specific, but interface is stddef.h




回答3:


Since @Good Person said this wasn't specific to Linux, in Microsoft Visual Studio, ptrdiff_t is defined in:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include\vcruntime.h



来源:https://stackoverflow.com/questions/3597743/where-is-ptrdiff-t-defined-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!