Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C99
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Design== [[File:1999 ISO C Concepts.png|thumb]] C99 is, for the most part, backward compatible with C89, but it is stricter in some ways.<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Standards.html |title=Standards - Using the GNU Compiler Collection (GCC) |publisher=Gcc.gnu.org |access-date=2014-04-08}}</ref> In particular, a declaration that lacks a type specifier no longer has <code>int</code> implicitly assumed. The C standards committee decided that it was of more value for compilers to diagnose inadvertent omission of the type specifier than to silently process legacy code that relied on implicit <code>int</code>. In practice, compilers are likely to display a warning, then assume <code>int</code> and continue translating the program. C99 introduced several new features, many of which had already been implemented as extensions in several compilers:<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html |title=C Dialect Options - Using the GNU Compiler Collection (GCC) |publisher=Gcc.gnu.org |date=2009-05-06 |access-date=2014-04-08}}</ref> * [[inline function]]s * intermingled declarations and code: [[Variable (programming)|variable]] declaration is no longer restricted to file scope or the start of a compound statement (block) * several new [[data type]]s, including <code>long long int</code>, optional extended integer types, an explicit [[Boolean data type]], and a <code>complex</code> type to represent [[complex number]]s * [[variable-length array]]s (although subsequently relegated in [[C11 (C standard revision)|C11]] to a conditional feature that implementations are not required to support) * [[flexible array member]]s * support for one-line [[comment (programming)|comments]] beginning with <code>//</code>, as in [[BCPL]], [[C++]] and [[Java (programming language)|Java]] * new library functions, such as <code>snprintf</code> * new [[header file|headers]], such as <code><[[stdbool.h]]></code>, <code><[[complex.h]]></code>, <code><[[tgmath.h]]></code>, and <code><[[inttypes.h]]></code> * type-generic math (macro) functions, in <code><tgmath.h></code>, which select a [[math library]] [[library function|function]] based upon <code>float</code>, <code>double</code>, or <code>long double</code> arguments, etc. * improved support for [[IEEE floating point]] * designated initializers. For example, initializing a structure by field names: <code>struct point p = { .x = 1, .y = 2 };</code><ref>{{cite web |url=https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Designated-Inits.html |title=Using the GNU Compiler Collection (GCC): Designated Initializers |website=gnu.org |access-date=18 September 2019}}</ref> * compound literals. For instance, it is possible to construct structures in function calls: <code>function((struct x) {1, 2})</code><ref>{{cite web |url=https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Compound-Literals.html |title=Using the GNU Compiler Collection (GCC): Compound Literals |website=gnu.org |access-date=31 January 2016}}</ref> * support for [[variadic macro]]s (macros with a variable number of arguments) * <code>[[restrict]]</code> qualification allows more aggressive code [[optimization (computer science)|optimization]], removing compile-time array access advantages previously held by [[FORTRAN]] over ANSI C<ref>{{cite web |url=https://lwn.net/Articles/255364/ |title=What every programmer should know about memory |date=2007-10-23 |access-date=2015-04-03 |author=Ulrich Drepper |publisher=[[LWN.net]]}}</ref> * universal character names, which allows user variables to contain other characters than the standard character set: four-digit {{code|\u0040}} or eight-digit hexadecimal sequences {{code|\U0001f431}} * keyword <code>static</code> in array indices in parameter declarations<ref>{{cite book | url=https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf | title=ISO/IEC 9899:1999 specification, TC3 | at=p. 119, Β§ 6.7.5.3 ''Function declarators (including prototypes)'' para. 7}}</ref> Parts of the C99 standard are included in the current version of the [[C++]] standard, including integer types, headers, and library functions. Variable-length arrays are not among these included parts because C++'s [[Standard Template Library]] already includes similar functionality.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)