From WikiChip
Editing c/c99

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.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{c title|C99}}{{C standards}}
+
{{C standards}}
 
'''C99''' is a past version of the [[C programming language]] standard which was ratified by ISO in 1999 and became '''ISO/IEC 9899:1999'''. The same standard was later also adopted by ANSI on May 22, 2000. C99 cancels and replaces the first edition, [[C89]], and [[Normative Addendum 1|NA1]].
 
'''C99''' is a past version of the [[C programming language]] standard which was ratified by ISO in 1999 and became '''ISO/IEC 9899:1999'''. The same standard was later also adopted by ANSI on May 22, 2000. C99 cancels and replaces the first edition, [[C89]], and [[Normative Addendum 1|NA1]].
  
Line 14: Line 14:
  
 
== New headers ==
 
== New headers ==
C99 introduced 6 new [[C standard library|standard headers]]: {{C|tgmath.h|<tgmath.h>}}, {{C|stdint.h|<stdint.h>}}, {{C|stdbool.h|<stdbool.h>}}, {{C|inttypes.h|<inttypes.h>}}, {{C|fenv.h|<fenv.h>}}, and {{C|complex.h|<complex.h>}}.
+
C99 introduced 6 new [[C standard library|standard headers]]: [[tgmath.h - C|<tgmath.h>]], [[stdint.h - C|<stdint.h>]], [[stdbool.h - C|<stdbool.h>]], [[inttypes.h - C|<inttypes.h>]], [[fenv.h - C|<fenv.h>]], and [[complex.h - C|<complex.h>]].
  
 
== Restricted pointers ==
 
== Restricted pointers ==
{{main|c/restricted pointers|l1=Restricted pointers}}
+
{{main|Restricted pointers - C|l1=Restricted pointers}}
C99 introduced the concept of restricted pointer to the C language through the introduction of the '''{{C|restrict}}''' {{C|reserved keywords|keyword}}. Given two pointers, if they do not point to two distinct objects, they are said to be ''aliases''. The ''restrict'' keyword establishes a special association between the pointer and the object it accesses, guaranteeing all accesses to the object it points to occur through that pointer or expressions based on that pointer.
+
 
 +
C99 introduced the concept of restricted pointer to the C language through the introduction of the '''[[restrict - C|restrict]]''' [[Reserved keywords - C|keyword]]. Given two pointers, if they do not point to two distinct objects, they are said to be ''aliases''. The ''restrict'' keyword establishes a special association between the pointer and the object it accesses, guaranteeing all accesses to the object it points to occur through that pointer or expressions based on that pointer.
  
 
Since multiple pointers can point to the same object, compilers are often unable to make certain optimizations that require them to know that only a specific pointer has access to the object it points to. The restrict keyword was designed to aid such compiler issues. Consequently, various functions such as memcpy(), strcpy(), and strcat() have had their signatures changed to:
 
Since multiple pointers can point to the same object, compilers are often unable to make certain optimizations that require them to know that only a specific pointer has access to the object it points to. The restrict keyword was designed to aid such compiler issues. Consequently, various functions such as memcpy(), strcpy(), and strcat() have had their signatures changed to:
Line 29: Line 30:
  
 
== Variable-length array ==
 
== Variable-length array ==
{{main|c/variable-length array|l1=Variable length arrays}}
+
{{main|Variable-length array - C|l1=Variable length arrays}}
 +
 
 
'''Variable-length array''' ('''VLA''') are arrays of automatic storage whose size is determined at run-time. C99 introduced support for variable-length arrays. The length of the array does not change throughout the duration of the object's lifetime.
 
'''Variable-length array''' ('''VLA''') are arrays of automatic storage whose size is determined at run-time. C99 introduced support for variable-length arrays. The length of the array does not change throughout the duration of the object's lifetime.
  
Line 42: Line 44:
  
 
== Complex numbers ==
 
== Complex numbers ==
{{main|c/complex numbers|l1=Complex numbers}}
+
{{main|Complex numbers - C|l1=Complex numbers}}
C99 brought support for complex numbers including a set of functions for dealing with complex numbers which can be found in {{C|complex.h|<complex.h>}}. For example,
+
 
 +
C99 brought support for complex numbers including a set of functions for dealing with complex numbers which can be found in [[complex.h - C|<complex.h>]]. For example,
  
 
<source lang="C">
 
<source lang="C">
Line 61: Line 64:
  
 
== Type-generic math ==
 
== Type-generic math ==
{{main|c/tgmath.h|l1=<tgmath.h>}}
+
{{main|tgmath.h - C|l1=<tgmath.h>}}
C99 introduce the {{C|tgmath.h|<tgmath.h>}} header which provide {{C|generic selection|type-generic macros}} that determine the function depending on the arguments provided.
+
 
 +
C99 introduce the [[tgmath.h - C|<tgmath.h>]] header which provide [[generic selection - C|type-generic macros]] that determine the function depending on the arguments provided.
  
 
== Extended identifiers ==
 
== Extended identifiers ==
{{main|c/extended identifiers|l1=Extended identifiers}}
+
{{main|Extended identifiers - C|l1=Extended identifiers}}
 +
 
 
C99 brought support for extended identifiers and extended characters. For example:
 
C99 brought support for extended identifiers and extended characters. For example:
  
Line 80: Line 85:
  
 
== Compound literal ==
 
== Compound literal ==
{{main|c/compound literals|l1=compound literals}}
+
{{main|Compound literals - C|l1=compound literals}}
 +
 
 
A compound literal is a postfix expression that provides an unnamed object whose value is given by the initializer list. Such expressions may be const as well. Compound literals take the form <code>(type-name){initializer-list}</code>. For example,
 
A compound literal is a postfix expression that provides an unnamed object whose value is given by the initializer list. Such expressions may be const as well. Compound literals take the form <code>(type-name){initializer-list}</code>. For example,
  
Line 98: Line 104:
  
 
== Designated initializers ==
 
== Designated initializers ==
{{main|c/designated initializers|l1=designated initializers}}
+
{{main|designated initializers - C|l1=designated initializers}}
'''Designated initializers''' are a feature added in C99 that allows a particular element to be initialized. Designated initializers are supported for {{C|arrays}}, {{C|structures|structs}}, and {{C|unions}}. For example:
+
 
 +
'''Designated initializers''' are a feature added in C99 that allows a particular element to be initialized. Designated initializers are supported for [[Arrays - C|arrays]], [[Structures - C|structs]], and [[Unions - C|unions]]. For example:
  
 
<source lang="C">
 
<source lang="C">
Line 129: Line 136:
  
 
== Extended integer types ==
 
== Extended integer types ==
{{main|c/extended integer types|l1=Extended integer types}}
+
{{main|Extended integer types - C|l1=Extended integer types}}
 +
 
 
Starting with C99, extended integer types were added to the C programming language. Extended integer types, which come in pairs of signed and unsigned types, are defined by the implementation in a manner they choose. They must obey the same standard integer rules but their names is up to the implementation, for example:
 
Starting with C99, extended integer types were added to the C programming language. Extended integer types, which come in pairs of signed and unsigned types, are defined by the implementation in a manner they choose. They must obey the same standard integer rules but their names is up to the implementation, for example:
  
Line 150: Line 158:
  
 
== inline functions ==
 
== inline functions ==
{{main|c/inline functions|l1=inline functions}}
+
{{main|inline functions - C|l1=inline functions}}
 +
 
 
Support for inline functions were added in C99.
 
Support for inline functions were added in C99.
  
 
== boolean types ==
 
== boolean types ==
{{main|c/stdbool.h|l1=<stdbool.h>}}
+
{{main|stdbool.h - C|l1=<stdbool.h>}}
C99 introduced a new boolean type with the <code>_Bool</code> keyword. A set of convenient macros are defined in the {{C|stdbool.h|<stdbool.h>}} header.
+
 
 +
C99 introduced a new boolean type with the <code>_Bool</code> keyword. A set of convenient macros are defined in the [[stdbool.h - C|<stdbool.h>]] header.
  
 
<source lang="C">
 
<source lang="C">

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)