函数是否在C语言中有任何存储类?

函数是否在C语言中有任何存储类?
最佳答案
答案是不.根据http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf(C99草案)和http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf(C11草案):

6.2.4 Storage durations of objects

1 An object has a storage duration that determines its lifetime.

函数不是对象,因此它们没有存储空间.

6.2.2 Linkages of identifiers

3 If the declaration of a file scope identifier for an object or a function contains the storage-class specifier static, the identifier has internal linkage.

这表示应用于函数的静态会影响其链接(没有可以应用的存储).

转载注明原文:函数是否在C语言中有任何存储类? - 代码日志