开发者

What is a C extension? [closed]

开发者 https://www.devze.com 2023-02-05 18:15 出处:网络
开发者_StackOverflow It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current
开发者_StackOverflow It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

What is the meaning of 'C extension'?


An extension in C is a feature supported by a C compiler that is not described (permitted, mandated) by the C standard. (And similarly for C++, since the question is tagged like that.)

For example, GCC allows you to define a function within the body of another function; standard C does not. That is a C extension.


Do you mean the .c extension on source code files? That just means that the code within the file is (supposed to be) C. It's different from the .cpp extension in that a .cpp extension indicates C++ code in the file.


Hijacking GreenMatt's answer

Possible extensions for C++ source code

On MacOS X, man g++ lists 7 possible/acceptable extensions for C++ source code:

  • file.cc
  • file.cp
  • file.cxx
  • file.cpp
  • file.CPP
  • file.c++
  • file.C

It also mentions file.i is a file that does not need pre-processing - it contains the output from the C preprocessor.

0

精彩评论

暂无评论...
验证码 换一张
取 消