1 \documentclass{article}
5 \usepackage[utf8]{inputenc}
6 \usepackage[parfill]{parskip}
12 %%% GEOMETRY FOR DOCUMENT
15 %%% HEADERS/FOOTERS APPEARANCE
16 \usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
17 \pagestyle{fancy} % options: empty , plain , fancy
18 \renewcommand{\headrulewidth}{0pt} % customise the layout...
19 \lhead{}\chead{}\rhead{}
20 \lfoot{}\cfoot{\thepage}\rfoot{}
22 %%% SECTION TITLE APPEARANCE
23 \allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
26 \usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
27 \usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
28 \renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
29 \renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!
31 %%% listing language definitions
32 %%% BNF for now, QuakeC will be later
33 \definecolor{keyword1}{RGB}{0,102,153}
34 \definecolor{keyword2}{RGB}{0,153,102}
35 \definecolor{keyword3}{RGB}{0,153,255}
36 \definecolor{comment}{RGB}{204,0,0}
37 \definecolor{function}{RGB}{153,102,255}
38 \definecolor{digit}{RGB}{255,0,0}
39 \definecolor{string}{RGB}{255,0,204}
40 \definecolor{rule}{RGB}{192,192,192}
41 \definecolor{back}{RGB}{250,250,250}
43 \lstdefinelanguage{bnf}{
44 keywordstyle={\color{keyword2}\bfseries},
46 otherkeywords={::=,|},
47 morecomment=[s][\color{comment}]{(*}{*)},
48 stringstyle=\color{string},
49 showstringspaces=false,
51 rulecolor=\color{rule},
52 backgroundcolor=\color{back}
55 %% Title Information %%
56 \title{The GMQCC QuakeC Programming Language}
67 This document specifies the form and establishes the interpretation of programs written in
68 the GMQCC QuakeC programming language variant (refereed simply as QuakeC throughout this
69 document). It specifies:
71 \item the representation of QuakeC programs;
72 \item the syntax and constraints of the QuakeC language;
73 \item the semantic rules for interpreting QuakeC programs;
74 \item the representation of input data to be processed by QuakeC programs;
75 \item the representation of output data produced by QuakeC programs;
76 \item the restrictions and limits imposed by a conforming implementation of QuakeC.
78 This document does not specify
80 \item the mechanism by which QuakeC programs are transformed for use by a data-
82 \item the mechanism by which QuakeC programs are invoked for use by a data-processing
84 \item the mechanism by which input data are transformed for use by a QuakeC program;
85 \item the size or complexity of a program and its data that will exceed the capacity
86 of any specific data-processing system or the capacity of a particular
87 execution environment;
88 \item all minimal requirements of a data-processing system that is capable of
89 supporting a conforming implementation.
92 %% Table Of Contents %%
99 \raggedright % No weird TEX spacing on lines to fill page
101 %% -> Terms, definitions, and symbols %%
102 \section{Terms, definitions, and symbols}
103 \subsection*{argument}
104 Expression in the comma-separated list bounded by the parentheses in a function call
105 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
106 by the parentheses in a function-like macro invocation.
108 \subsection*{behavior}
109 External appearance or action
111 \subsection*{implementation-defined behavior}
112 Unspecified behavior where each implementation documents how the choice is made.
114 \subsection*{undefined behavior}
115 Behavior, upon use of a non-portable or erroneous program construct or of erroneous data,
116 for which this document imposes no actual requirements.
118 \subsection*{unspecified behavior}
119 Use of an unspecified value, or other behavior where this document provides two or more
120 possibilities and imposes no further requirements on which is chosen in any instance.
122 \subsection*{constraint}
123 Restriction, either syntactic or semantic, by which the exposition of language elements
124 is to be interpreted.
126 \subsection*{diagnostic message}
127 Message belonging to an implementation-defined subset of the implementation's message
131 Region of data storage in the execution environment, the contents of which can represent
134 \subsection*{parameter}
135 Object declared as part of a function declaration or definition that acquires a value on
136 entry to the function, or an identifier from the comma-separated list bounded by the
137 parentheses immediately following the macro name in a function-like macro definition.
139 \subsection*{recommended practice}
140 Specification that is strongly recommended as being in keeping with the intent of this
141 document, but that may be impractical for some implementations.
144 Precise meaning of the contents of an object when interpreted as having a specific type.
146 \subsection*{implementation}
147 Particular set of software, running in a particular translation environment under
148 particular control options, that performs translation of programs for, and supports
149 execution of functions in, a particular execution environment.
151 \subsection*{implementation-defined value}
152 Unspecified value where each implementation documents how the choice is made.
154 \subsection*{unspecified value}
155 Valid value of the relevant type where this document imposes no requirements on which
156 value is chosen in any instance.
159 \section{Conformance}
160 In this document, "shall" is to be interpreted as a requirement on an implementation
161 or on a program; conversely, "shall not" is to be interpreted as a prohibition. \\
162 If a "shall" or "shall not" requirement that appears outside of a constraint is violated,
163 the behavior is undefined. Undefined behavior is otherwise indicated in this document by
164 the words "undefined behavior" or by the omission of any explicit definition of behavior.
165 There is no difference in emphasis among these three; they all describe "behavior that is
169 \section{Environment}
170 An implementation that translates QuakeC source files and executes QuakeC programs in two
171 data processing-system environments, which will be called the translation environment and
172 the execution environment in this document. Their characteristics define and constrain the
173 results of executing QuakeC programs constructed according to the syntactic and semantic
174 rules for conforming implementations.
175 \subsection{Conceptual models}
176 \subsubsection{Translation environment}
177 \paragraph*{Translation steps}
178 The precedence among the syntax rules of translation is specified by the following steps
180 \item Physical source file characters are mapped, in an implementation-defined manner,
181 to the source character set (introducing new-line characters for end-of-line
182 indicators) if necessary. Trigraph and digraph sequences are replaced by their
183 corresponding single-character internal representations.
184 \item The source file is decomposed into preprocessing tokens and sequences of white-
185 space characters (including comments). A source file shall not end in a partial
186 preprocessing token or in a partial comment. Each comment is replaced by one
187 space character. New-line characters are retained. Whether each nonempty
188 sequences of white-space characters other than new-line is retained or replaced
189 by one space character is implementation-defined.
190 \item Preprocessing directives are executed, macro invocations are expanded
191 recursively. A \#include preprocessing directive causes the named header or
192 source file to be processed from step one through step three, recursively. All
193 preprocessing directives are then deleted.
194 \item Each source character set member and escape sequence in character constants and
195 string literals is converted to the corresponding member of the execution
196 character set; if there is no corresponding member, it is converted to an
197 implementation-defined member other than the null character.
198 \item Adjacent string literal tokens are concatenated.
199 \item White-space characters seperating tokens are no longer significant. Each
200 preprocessing token is converted into a token. The resulting tokens are then
201 syntactically and semantically analyzed and translated.
203 \subparagraph*{Footnotes}
204 Implementations shall behave as if these steps occur separately, even though many are likely
205 to be folded together in practice. Source files need not be stored as file, nor need there
206 be any one-to-one correspondence between these items and any external representation. The
207 description is conceptual only, and does not specify any particular implementation.
209 \paragraph*{Diagnostics}
210 A conforming implementation shall produce at least on diagnostic message(identified in an
211 implementation-defined manner) if a source file contains a violation of any syntax rule or
212 constraint, even if the behavior is also explicitly specified as undefined or
213 implementation-defined. Diagnostic messages need not be produced in other circumstances.
215 %% ->-> Execution environments %%
216 \subsubsection{Execution environment}
217 A conforming execution environment shall provide at minimal the following 15 definitions
218 for built in functions, with an accompanying header or source file that defines them.
220 \item entity () spawn
221 \item void (entity) remove
223 \item string (float) ftos
224 \item string (vector) vtos
225 \item string (entity) etos
226 \item float (string) stof
228 \item void (string, ...) dprint
229 \item void (entity) eprint
231 \item float (float) rint
232 \item float (float) floor
233 \item float (float) ceil
234 \item float (float) fabs
235 \item float (float) sin
236 \item float (float) cos
237 \item float (float) sqrt
239 The numbers of which these built-ins are assigned is implementation-defined;
240 an implementation is allowed to use these built-ins however it sees fit.
245 \subsection{Notation}
246 The syntax notation used in this document is that of a BNF specification. A set of
247 derivation rules, often written as:
248 \begin{lstlisting}[language=bnf]
249 symbol ::= expression
251 Where symbol is a nonterminal, and the expression consists of one or more sequences of
252 symbols; more sequences are separated by a vertical bar \textbar, indicating a choice,
253 the whole being a possible substitution for the symbol on the left. Symbols that never
254 appear on the left side are terminals.
257 This document defines language syntax throughout it's way at defining language
258 constructs If you're interested in a summary of the language syntax, one is given in
262 \subsection{Concepts}
263 %% ->-> Scopes of identifiers %%
264 \subsubsection{Scopes of identifiers}
265 An identifier can denote an object; a function, or enumeration; a label name; a macro
266 name; or a macro parameter. The same identifier can denote different items at different
267 points in the program. A member of an enumeration is called an enumeration constant.
268 Macro names and macro parameters are not considered further here, because prior to the
269 semantic phase of program translation any occurrences of macro names in the source file
270 are replaced by the preprocessing token sequences that constitute their macro definitions.
273 For each different item that an identifier designates, the identifier is visible (i.e,
274 can be used) only within a region of program text called its scope. Different items
275 designated by the same identifier either have different scopes, or are in different name
276 spaces. There are four kinds of scopes: function, file, block and function prototype.
277 (A function prototype is a declaration of a function that declares the types of its
281 A label name is the only kind of identifier that has function scope. It can be used (in
282 a goto statement) anywhere in the function in which it appears, and is declared
283 implicitly by its syntactic appearance (prefixed by a colon :, and suffixed with a
287 Every other identifier has scope determined by the placement of its declaration (in a
288 declarator or type specifier). If the declarator or type specifier that declares the
289 identifier appears outside any block or list of parameters, the identifier has file
290 scope, which terminates at the end of the file. If the declartor or type specifier that
291 declares the identifier appears inside a block or within the list of parameter
292 declarations in a function definition, the identifier has block scope, which terminates
293 at the end of the associated block. If the declarator or type specifier that declares
294 the identifier appears within the list of parameter declarations in a function prototype
295 (not part of a function definition), the identifier has function prototype scope, which
296 terminates at the end of the function declarator. If an identifier designates two
297 different items in the same name space, the scopes might overlap. If so, the scope of
298 one item (the inner scope) will be a strict subset of the scope of the other item (the
299 outer scope). Within the inner scope, the identifier designates the item declared in the
300 inner scope; the item declared in the outer scope is hidden (and not visible) within
304 Unless explicitly stated otherwise, where this document uses the term "identifier" to
305 refer to some item (as opposed to the syntactic construct), it refers to the item in the
306 relevant name space whose declaration is visible at the point the identifier occurs.
309 Two identifiers have the same scope if and only if their scopes terminate at the same
313 Each enumeration constant has scope that begins just after the appearance of its defining
314 enumerator in an enumerator list. Any other identifier has scope that begins just after
315 the completion of its declarator.
317 %% ->-> Name spaces of identifiers %%
318 \subsubsection{Name spaces of identifiers}
319 If more than one declaration of a particular identifier is visible at any point in a
320 source file, the syntactic context disambiguates uses that refer to different items.
321 Thus, there are separate name spaces for various categories of identifiers, as follows:
324 \item Label names (disambiguated by the syntax of the label declaration and use);
325 \item Enumerations (disambiguated by following the keyword enum);
326 \item All other identifiers, called ordinary identifiers (declared in ordinary
327 declarators or as enumeration constants).
331 \subsubsection{Types}
332 The meaning of a value stored in an object returned by a function is determined by the
333 type of the expression used to access it. (An identifier declared to be an object is the simplest
334 such expression; the type is specified in the declaration of the identifier.) Types are
335 partitioned into object types (types that fully describe objects), function types(types
336 that describe functions), and incomplete types(types that describe objects but lack
340 An object declared type bool is large enough to store the values 0 and 1.
343 An object declared type float is a real type; An object declared type vector is a
344 comprised set of three floats that respectively represent the \underline{x,y,z}
345 components of a three-dimensional vector.
348 An enumeration comprises a set of named integer constant values. Each distinct
349 enumeration constitutes a different enumerated type.
352 Enumeration types and float are collectively called arithmetic types. Each arithmetic
353 type belongs to one type domain.
356 The void type comprises an empty set of values; it is an incomplete type that cannot be
360 A number of derived types can be constructed from the object, function and incomplete
365 \item An array type describes a contiguously allocated nonempty set of objects with a
366 particular object type, called the element type. Array types are characterized
367 by their element type and by the number of elements in the array. An array type
368 is said to be derived from its element type, and if its element is type T, the
369 array type is sometimes called "array of T". The construction of an array type
370 from an element type is called "array type derivation".
371 \item A function type describes a function with a specified return type. A function
372 type is characterized by its return type and the number and types of its
373 parameters. A function type is said to be derived from its return type, and if
374 its return type is T, the function type is sometimes called "function returning
375 T". The construction of a function type from a return type is called "function
379 Arithmetic types are collectively called scalar types. Arrays and vectors are
380 collectively called aggregate types.
383 An array of unknown size is an incomplete type. It is completed, for an identifier of
384 that type, by specifying the size in a later declaration. Arrays are required to have
388 A type is characterized by its type category, which is either the outermost derivation
389 of a derived type (as noted above in the construction of derived types), or the type
390 itself if the type consists of no derived types.
393 Any type so far mentioned is an unqualified type. Each unqualified type has several
394 qualified versions of its type, corresponding to the combinations of one, two, or all
395 two of const and volatile qualifiers. The qualified or unqualified versions of a type
396 are distinct types that belong to the same type category and have the same representation.
397 A derived type is not qualified by the qualifiers (if any) of the type from which it
401 %% ->-> Compatible types and composite type %%
402 \subsubsection{Compatible types and composite type}
403 Two types have compatible type if their types are the same.
406 All declarations that refer to the same object or function shall have compatible type;
407 otherwise the behavior is undefined.
410 A composite type can be constructed from two types that are compatible; it is a type that
411 is compatible with both of the two types and satisfies the following conditions:
413 \item If one type is an array, the composite type is an array of that size.
414 \item If only one type is a function type with a parameter type list(a function
415 prototype), the composite type is a function prototype with the parameter type
417 \item If both types are function types with parameter type lists, the type of each
418 parameter in the composite parameter type list is the composite type of the
419 corresponding parameters.
421 These rules apply recursively to types from which the two types are derived.
425 \subsection{Conversions}
426 Several operators convert operand values from one type to another automatically. This
427 sub-clause specifies the result required from such an implicit conversion.
430 Conversion from an operand value to a compatible type causes no change to the value or
434 TODO: Specify all implicit conversions.
436 %% ->->Aritmetic operands %%
437 \subsubsection{Arithmetic operands}
438 \paragraph*{Boolean type}
439 When any scalar value is converted to bool, the result is 0 if the value compares equal
440 to 0; otherwise the result is 1.
442 %% ->->Other operands %%
443 \subsubsection{Other operands}
444 \paragraph{Lvalues, arrays and function designators}
445 An lvalue is an expression with an object type or an incomplete type other than void;
446 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
447 When an object is said to have a particular type, the type is specified by the lvalue
448 used to designate the object. A modifiable lvalue is an lvalue that does not have an
449 array type, does not have an incomplete type, and does not have a const-qualified type.
452 Except when it is the operand of the unary \& operator, the ++ operator, the -- operator,
453 or the left operand of the . operator or an assignment operator, an lvalue that does not
454 have array type is converted to the value stored in the designated object (and is no
455 longer an lvalue). If the lvalue has qualified type, the value has the unqualified
456 version of the type of the lvalue; otherwise, the value has the type of the lvalue. If
457 the lvalue has an incomplete type and does not have array type, the behavior is undefined.
460 A function designator is an expression that has function type.
463 The (nonexistent) value of a void expression (an expression that has type void) shall not
464 be used in any way, and implicit conversions (except to void) shall not be applied to
465 such an expression. If an expression of any other type is evaluated as a void expression,
466 its value or designator is discarded. (A void expression is only evaluated for its
470 \subsection{Lexical elements}
472 \begin{lstlisting}[language=bnf]
478 preprocessing-token ::= header-name
484 \paragraph*{Constraints}
485 Each preprocessing token that is converted to a token shall have the lexical form of a
486 keyword, an identifier, a constant, a string literal, or a punctuator.
488 \paragraph*{Semantics}
489 A token is the minimal lexical element of the language in translation steps six and seven.
490 The categories of tokens are: keywords, identifiers, constants, string literals, and
491 punctuators. A preprocessing token is the minimal lexical element of the language in
492 translation steps three through five. The categories of preprocessing tokens are: header
493 names, identifiers, preprocessing numbers, string literals, punctuators and other single
494 non-white-space characters that do not lexically match the other preprocessing token
495 categories. If a ' or a " character matches the last category, the behavior is undefined.
496 Preprocessing tokens can be separated by white space; this consists of comments (described
497 later), or white-space characters (space, horizontal tab, new-line, vertical tab, and form
498 -feed), or both. In certain circumstances during translation step four, white space (or
499 the absence thereof) serves as more than preprocessing token separation. White space may
500 appear within a preprocessing token only as part of a header name or between the quotation
501 characters in a string literal.
504 If the input stream has been parsed into preprocessing tokens up to a given character, the
505 next preprocessing token is the longest sequence of characters that could constitute a
506 preprocessing token. There is one exception to this rule: header name preprocessing tokens
507 are recognized only within \#include preprocessing directives and in implementation-defined
508 locations within \#pragma directives. In such contexts, a sequence of characters that
509 could be either a header name or string literal is recognized as the former.
512 \subsubsection{Keywords}
514 \begin{lstlisting}[language=bnf]
515 keyword ::= enum | break | return | void
516 | case | float | volatile | for
517 | while | const | goto | bool
518 | continue | if | static | default
519 | inline | do | switch | else
522 \paragraph*{Semantics}
523 The above tokens (case sensitive) are reserved (in translation step seven and eight) for
524 use as keywords, and shall not be used otherwise.
526 %% ->->Identifiers %%
527 \subsubsection{Identifiers}
528 \begin{lstlisting}[language=bnf]
529 identifier ::= nondigit
530 | identifier nondigit
533 nondigit ::= _ | a | b | c | d | e | f | g | h | i
534 | j | k | l | m | n | o | p | q | r | s
535 | t | u | v | w | x | y | z | A | B | C
536 | D | E | F | G | H | I | J | K | L | M
537 | N | P | Q | R | S | T | U | V | W | X
540 digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
542 \paragraph*{Semantics}
543 An identifier is a sequence of nondigit characters (including the underscore \_, the lower
544 case and upper case Latin letters, and other characters) and digits, which designates one
545 or more items. Lowercase and uppercase letters are distinct. There is a specific limit of
546 65535 characters for an identifier.
549 When preprocessing tokens are converted to tokens during translation step six, if a
550 preprocessing token could not be converted to either a keyword or an identifier, it is
551 converted to a keyword.
553 \paragraph*{Predefined identifiers}
554 Any identifiers that begin with the prefix \_\_builtin, or are within the reserved name
555 space are reserved by the implementation.
558 \subsubsection{Constants}
559 \begin{lstlisting}[language=bnf]
560 constant ::= integer-constant
562 | enumeration-constant
566 integer-constant ::= decimal-constant
568 | hexadecimal-constant
570 decimal-constant ::= nonzero-digit
571 | decimal-constant digit
574 | octal-constant octal-digit
576 hexadecimal-constant ::= hexdecimal-prefix
581 hexadecimal-prefix: ::= 0x | 0X
583 nonzero-digit ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
586 octal-digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
588 hexadecimal-digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
589 | 8 | 9 | a | b | c | d | e | f
590 | A | B | C | D | E | F
593 %% ->-> String literals %%
594 \subsubsection{String literals}
595 \begin{lstlisting}[language=bnf]
596 string-literal := " s-char-sequence "
598 s-char-sequence := s-char
599 | s-char-sequence s-char
601 s-char := ` | ! | @ | # | $ | % | ^ | & | *
602 | ( | ) | _ | - | + | = | { | } | [
603 | ] | | | : | ; | ' | < | , | > | .
604 | ? | / | 1 | 2 | 3 | 4 | 5 | 6 | 7
605 | 8 | 9 | 0 | q | w | e | r | t | y
606 | u | i | o | p | a | s | d | f | g
607 | h | j | k | l | z | x | c | v | b
608 | n | m | Q | W | E | R | T | Y | U
609 | I | O | P | A | S | D | F | G | |
610 | H | J | K | L | Z | X | C | V | B
613 \paragraph*{Description}
614 A character string literal is a sequence of zero or more characters enclosed in
615 double-quotes, as in "xyz".
618 The same considerations apply to each element of the sequence in a character string
619 literal as if it where an integer character constant, except that the single-quote
620 ' is representable either by itself or by the escape sequence \textbackslash', but
621 the double-quote " shall be represented by the escape sequence \textbackslash".
623 \paragraph*{Semantics}
624 In translation stage six, the character sequences specified by any sequence of adjacent
625 character string literal tokens are concatenated into a single character sequence.
627 %% ->-> Punctuators %%
628 \subsubsection{Punctuators}
631 A punctuator is a symbol that has independent syntactic and semantic significance.
632 Depending on context, it may specify an operation to be performed (which in turn
633 may yield a value or a function designator, produce a side effect, or some combination
634 thereof) in which case it is known as an operator (other forms of operator also exist
635 in some contexts). An operand is an item on which an operator acts.
638 TODO: Trigraphs \& Digraphs
640 \subsubsection{Header names}
642 \subsubsection{Preprocessing numbers}
644 \subsubsection{Comments}
645 Except within a character constant, a string literal, or a comment, the characters /*
646 introduce a comment. The contents of such a comment are examined only to identify
647 characters and to find the characters */ that terminate it.
650 Except within a character constant, a string literal, or a comment, the characters //
651 introduce a comment that includes all characters up to, but not including, the next
652 new-line character. The contents of such a comment are examined only to identify
653 characters and to find the terminating new-line character.
657 \subsection{Expressions}
658 An expression is a sequence of operators and operands that specifies computation of a
659 value, or that designates an object or function, or that generates side effects, or that
660 performs a combination thereof.
663 Between the previous and next sequence point an object shall have its stored value
664 modified at most once by the evaluation of an expression. Furthermore, the prior value
665 shall be read only to determine the value to be stored.
668 The grouping of operators and operands is indicated by the syntax. Except as specified
669 later (for the function call (), \&\&, \textbar\textbar ?:, and comma operators), the
670 order of evaluation of sub-expressions and the order in which side effects take place
671 are both unspecified.
674 Some operators (the unary \textasciitilde operator, and the binary operators \textless
675 \textless, \textgreater\textgreater, \&, \^, and \textbar, collectively describe bitwise
676 operators) are required to have operands that are either integer, or floating point with
677 zero points of decimal precision.
680 If an exceptional condition occurs during the evaluation of an expression (that is, if
681 the result is not mathematically defined or not in the range or representable values for
682 its type), the behavior is undefined.
684 %% ->-> Primary expressions %%
685 \subsubsection{Primary expressions}
687 \begin{lstlisting}[language=bnf]
688 primary-expression ::= identifier
693 \paragraph*{Semantics}
694 An identifier is a primary expression, provided it has been declared as designating an
695 object(in which case it is an lvalue) or a function(in which case it is a function
699 A constant is a primary expression. Its type depends on its form and value.
702 A string literal is a primary expression. It is an lvalue.
705 A parenthesized expression is a primary expression. Its type and value identical to
706 those of the unparenthesized expression. It is an lvalue, a function designator, or a
707 void expression if the unparenthesized expression is, respectively, an lvalue, a
708 function designator, or a void expression.
710 %% ->-> Constant expressions %%
711 \subsubsection{Constant expressions}
713 \begin{lstlisting}[language=bnf]
714 constant-expression ::= conditional-expression
716 \paragraph*{Description}
717 A constant expression can be evaluated during translation rather than runtime, and
718 accordingly may be used in any place that a constant may be.
719 \paragraph*{Constraints}
721 \item Constant expressions shall not contain assignment, increment, decrement,
722 function-call, or comma operators, except when contained within a subexpression
723 that is not evaluated.
724 \item Each constant expression shall evaluate to a constant that is in range of
725 representable values for its type.
727 \paragraph*{Semantics}
728 An expression that evaluates to a constant is required in several contexts. If a floating
729 point expression is evaluated in the translation environment, the arithmetic precision range
730 shall be as great is if the expression were being evaluated in the execution environment.
733 An integer constant expression shall have integer type and shall only have operands that
734 are integer constants, enumeration constants, character constants, and floating constants
735 that are the immediate operand of casts. Cast operators in an integer constant expression
736 shall only convert arithmetic types to integer types.
739 More latitude is permitted for constant expressions in initializers. Such a constant expression
740 shall be, or evaluate to an arithmetic constant expression.
743 An arithmetic constant expression shall have arithmetic type and shall only have operands that
744 are integer constants, floating constants, enumeration constants, and character constants. Cast
745 operators in an arithmetic constant expression shall only convert arithmetic types to arithmetic
749 An implementation may accept other forms of constant expressions.
752 The semantic rules for the evaluation of a constant expression are the same as for nonconstant
756 \bibliographystyle{abbrv}