ISO/IEC Information technology – Programming languages – C 1 This document specifies the form and establishes the interpretation of programs. Information and communication technology (ICT) standards often exist because a tech-guru has translated a vision into a technical statement. Annex D (normative) Universal character names for identifiers. Annex E ( informative) Implementation limits. Annex F (normative) IEC floating-point .
|Published (Last):||10 September 2013|
|PDF File Size:||7.31 Mb|
|ePub File Size:||4.42 Mb|
|Price:||Free* [*Free Regsitration Required]|
GCC supports the D 2. When you need a true compile-time constant, use a preprocessor define or perhaps an enum. Unfortunately, neither of the definitions relating to conforming programs are as practically useful as one might wish. Declaring a function as snsi does not merely shut off or rearrange warnings: GCC does not support the uncorrected version. The latest defect report summary for C11 is amsi at n Most of the time, you should let the compiler count the initializers when initializing arrays in the case of the initializer “abc”of course, the computed size will be 4.
Many compilers support a few non-Standard extensions, gcc more so than most.
For more information concerning the history of Objective-C that is available online, see http: Use of the -std options listed above disables these extensions where they conflict with 8999 C standard version selected. This article needs additional citations for verification.
ISO/IEC – Programming languages — C
Return a null pointer or a pointer to 0 bytes? People seem to make a point of distinguishing between implementation-defined, unspecified, and undefined behavior. The primary application, which is an important one, would have been for the formal parameters of functions designed to perform computations on large arrays.
But it sets up a situation in which p2 ‘s promise–that the ultimately-pointed-to value won’t be modified–cannot be kept. Parts of that treaty consist of features which the compiler implementor agrees to provide, and which the user may assume will be available. If you’re interested in writing portable code, you can ignore the distinctions, as you’ll usually want to avoid code that depends on any of the three behaviors.
Many people on the net recommend ignoring the annotations entirely. ANSI C is now supported by almost all the widely used compilers. He obviously didn’t understand basketball.
11. ANSI/ISO Standard C
There are very few realistic, useful, strictly conforming programs. Doing so is legal and can be useful for backwards compatibilitybut requires a certain izo of care see especially question Modern practice, however, is to use the prototyped form in both declarations and definitions.
It is equivalent to the ifndef trick mentioned in question In the above example, a prototype is used in a function declaration for ANSI compliant implementations, while an obsolescent non-prototype declaration is used otherwise. To use the facilities of a hosted environment, you need to find them elsewhere for example, in the GNU C library.
Several prototype generators exist, many as modifications to lint. July Learn how and when to remove this template message.
C89 and C90 are identical except for the frontmatter and section numbering. It can be dangerous and confusing: Simply stated, the Standard talks about three kinds of conformance: For references to Technical Corrigenda, Rationale documents and information concerning the history of C that is available online, see http: I know that the code is ANSI, because gcc accepts it.
This standard, in both its forms, is commonly known as C89or occasionally as C90from the dates of ratification. See also questions 1. Here is another way of looking at it, due to Roger Miller: A compiler may do anything it likes when faced with undefined behavior and, within limits, with implementation-defined and unspecified behaviorincluding doing what you expect. What’s the correct declaration of main? A hosted implementation is intended for use with conventional application programs; a freestanding implementation is intended for use with embedded systems and the like, and is not required to supply all of the standard library functions.
It works because the Xstr macro expands its argument, and then Str stringizes it. Many standards can be ordered from good technical booksellers, such as Opamp. See also question 1.
Using the GNU Compiler Collection (GCC): Standards
Some features that are part of the C99 standard are accepted as extensions in C90 mode, and some features that are part of the C11 standard are accepted as extensions in C90 and C99 modes. Views Read Edit View history. It has always been a characteristic of C that certain constructs behaved in whatever way a particular compiler or a particular piece of hardware chose to implement them.