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 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]]: | + | 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| | + | {{main|Restricted pointers - C|l1=Restricted pointers}} |
− | C99 introduced the concept of restricted pointer to the C language through the introduction of the ''' | + | 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 29: | ||
== Variable-length array == | == Variable-length array == | ||
− | {{main| | + | {{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 42: | ||
== Complex numbers == | == Complex numbers == | ||
− | {{main| | + | {{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 | + | 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 61: | ||
== Type-generic math == | == Type-generic math == | ||
− | {{main| | + | {{main|tgmath.h - C|l1=<tgmath.h>}} |
− | C99 introduce the | + | 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| | + | {{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 80: | ||
== Compound literal == | == Compound literal == | ||
− | {{main| | + | {{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 98: | ||
== Designated initializers == | == Designated initializers == | ||
− | {{main| | + | {{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 | + | '''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 120: | Line 120: | ||
{ | { | ||
printf("%s -> %s\n", boss_list[manhandla].name, boss_list[manhandla].weapon[0]); | printf("%s -> %s\n", boss_list[manhandla].name, boss_list[manhandla].weapon[0]); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
return 0; | return 0; | ||
} | } | ||
Line 194: | Line 149: | ||
{{reflist}} | {{reflist}} | ||
− | + | [[Category:C programming language]] | |
− | |||
− | |||
[[Category:C standards]] | [[Category:C standards]] |