 Timestamp:
 Sep 13, 2015, 2:03:00 PM (9 years ago)
 Branches:
 ADT, aaronthesis, armeh, astexperimental, cleanupdtors, ctor, deferred_resn, demangler, enum, forallpointerdecay, gc_noraii, jacob/cs343translation, jenkinssandbox, master, memory, newast, newastuniqueexpr, newenv, no_list, persistentindexer, pthreademulation, qualifiedEnum, resolvnew, string, with_gc
 Children:
 05f0d98
 Parents:
 32a1e5fd
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

doc/refrat/refrat.tex
r32a1e5fd r2fc0e5c 1 % requires tex packages: texlivebase texlivelatexbase texcommon texlivehumanities texlivelatexextra texlivefontsrecommended 2 1 3 \documentclass[openright,twoside]{report} 2 4 \usepackage{fullpage,times} … … 55 57 \def\c11{ISO/IEC C}% cannot have numbers in latex command name 56 58 59 % replace/adjust characters that look bad in sanserif 60 \makeatletter 61 \lst@CCPutMacro 62 \lst@ProcessOther{"2D}{\lst@ttfamily{{}}{{\ttfamily\upshape }}} % replace minus 63 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than 64 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than 65 \lst@ProcessOther{"5E}{$\sim$} % circumflex 66 \lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore 67 \lst@ProcessOther{"7E}{\raisebox{.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde 68 \@empty\z@\@empty 69 70 \newcommand{\Index}{\@ifstar\@sIndex\@Index} 71 \newcommand{\@Index}[2][\@empty]{\lowercase{\def\temp{#2}}#2\ifx#1\@empty\index{\temp}\else\index{#1@{\protect#2}}\fi} 72 \newcommand{\@sIndex}[2][\@empty]{#2\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi} 73 \makeatother 74 57 75 \lstdefinelanguage{CFA}[ANSI]{C}% 58 76 {morekeywords={asm,_Atomic,catch,choose,_Complex,context,dtype,fallthru,forall,ftype,_Imaginary,lvalue,restrict,throw,try,type,}, … … 71 89 72 90 \setcounter{secnumdepth}{3} % number subsubsections 91 \setcounter{tocdepth}{3} % subsubsections in table of contents 73 92 \makeindex 74 93 … … 142 161 143 162 \CFA's scope rules differ from C's in one major respect: a declaration of an identifier may 144 overload\index{overloading} outer declarations of lexically identical identifiers in the same name 145 space\index{name spaces}, instead of hiding them. The outer declaration is hidden if the two 146 declarations have compatible type\index{compatible type}, or if one declares an array type and the 147 other declares a pointer type and the element type and pointedat type are compatible, or if one has 148 function type and the other is a pointer to a compatible function type, or if one declaration is a 149 \lstinline$type$\use{type} or \lstinline$typedef$\use{typedef} declaration and the other is not. 150 The outer declaration becomes visible\index{visible} when the scope of the inner declaration 151 terminates. 163 overload\index{overloading} outer declarations of lexically identical identifiers in the same 164 \Index{name space}, instead of hiding them. The outer declaration is hidden if the two declarations 165 have \Index{compatible type}, or if one declares an array type and the other declares a pointer type 166 and the element type and pointedat type are compatible, or if one has function type and the other 167 is a pointer to a compatible function type, or if one declaration is a \lstinline$type$\use{type} or 168 \lstinline$typedef$\use{typedef} declaration and the other is not. The outer declaration becomes 169 \Index{visible} when the scope of the inner declaration terminates. 152 170 \begin{rationale} 153 171 Hence, a \CFA program can declare an \lstinline$int v$ and a \lstinline$float v$ in the same … … 156 174 157 175 158 \subsection{Linkage of identifiers} \index{linkage}159 160 \CFA's linkage rules differ from C's in only one respect: instances of a particular identifier 161 with external or internal linkage do not necessarily denote the same object or function. Instead, 162 in the set of translation units and libraries that constitutes an entire program, any two instances 163 of a particular identifier with external linkage\index{external linkage} denote the same object or 164 function if they have compatible types\index{compatible type}, or if one declares an array type and 165 the other declares a pointer type and the element type and pointedat type are compatible, or if one 166 has function type and the other is a pointer to a compatible function type. Within one translation 167 unit, each instance of an identifier with internal linkage\index{internal linkage} denotes the same 168 object or function in the same circumstances. Identifiers with no linkage\index{no linkage} always 169 denote unique entities.176 \subsection{Linkage of identifiers} 177 \index{linkage} 178 179 \CFA's linkage rules differ from C's in only one respect: instances of a particular identifier with 180 external or internal linkage do not necessarily denote the same object or function. Instead, in the 181 set of translation units and libraries that constitutes an entire program, any two instances of a 182 particular identifier with \Index{external linkage} denote the same object or function if they have 183 \Index{compatible type}s, or if one declares an array type and the other declares a pointer type and 184 the element type and pointedat type are compatible, or if one has function type and the other is a 185 pointer to a compatible function type. Within one translation unit, each instance of an identifier 186 with \Index{internal linkage} denotes the same object or function in the same circumstances. 187 Identifiers with \Index{no linkage} always denote unique entities. 170 188 \begin{rationale} 171 189 A \CFA program can declare an \lstinline$extern int v$ and an \lstinline$extern float v$; a C … … 175 193 \section{Conversions} 176 194 \CFA defines situations where values of one type are automatically converted to another type. 177 These conversions are called \define{implicit conversion s}. The programmer can request178 \define{explicit conversion s}using cast expressions.195 These conversions are called \define{implicit conversion}s. The programmer can request 196 \define{explicit conversion}s using cast expressions. 179 197 180 198 … … 184 202 185 203 \subsubsection{Safe arithmetic conversions} 186 In C, a pattern of conversions known as the \define{usual arithmetic conversion s}is used with most204 In C, a pattern of conversions known as the \define{usual arithmetic conversion}s is used with most 187 205 binary arithmetic operators to convert the operands to a common type and determine the type of the 188 206 operator's result. In \CFA, these conversions play a role in overload resolution, and 189 collectively are called the \define{safe arithmetic conversion s}.207 collectively are called the \define{safe arithmetic conversion}s. 190 208 191 209 Let \(int_r\) and \(unsigned_r\) be the signed and unsigned integer types with integer conversion 192 rank\index{integer conversion rank} 210 rank\index{integer conversion rank}\index{ranksee{integer conversion rank}} $r$. Let 193 211 \(unsigned_{mr}\) be the unsigned integer type with maximal rank. 194 212 … … 196 214 \begin{itemize} 197 215 \item 198 The integer promotions\index{integer promotions}.216 The \Index{integer promotion}s. 199 217 200 218 \item … … 234 252 235 253 \begin{rationale} 236 Note that {\c11} does not include conversion from real types\index{real type} to complex 237 types\index{complex type} in the usual arithmetic conversions, and \CFA does not include them as 238 safe conversions. 254 Note that {\c11} does not include conversion from \Index{real type}s to \Index{complex type}s in the 255 usual arithmetic conversions, and \CFA does not include them as safe conversions. 239 256 \end{rationale} 240 257 … … 248 265 249 266 If an expression's type is a pointer to a structure or union type that has a member that is an 250 anonymous structure\index{anonymous structure} or an anonymous union\index{anonymous union}, it can 251 be implicitly converted\index{implicit conversions} to a pointer to the anonymous structure's or 252 anonymous union'stype. The result of the conversion is a pointer to the member.267 \Index{anonymous structure} or an \Index{anonymous union}, it can be implicitly 268 converted\index{implicit conversion} to a pointer to the anonymous structure's or anonymous union's 269 type. The result of the conversion is a pointer to the member. 253 270 254 271 \examples … … 273 290 274 291 \subsubsection{Specialization} 275 A function or value whose type is polymorphic may be implicitly converted to one whose type is less 276 polymorphic\index{less polymorphic} by binding values to one or more of its inferred 277 parameters\index{inferred parameter}. Any value that is legal for the inferred parameter may be 278 used, including other inferred parameters. 279 280 If, after the inferred parameter binding, an assertion parameter\index{assertion parameters} has no 281 inferred parameters in its type, then an object or function must be visible at the point of the 282 specialization that has the same identifier as the assertion parameter and has a type that is 283 compatible\index{compatible type} with or can be specialized to the type of the assertion parameter. 284 The assertion parameter is bound to that object or function. 292 A function or value whose type is polymorphic may be implicitly converted to one whose type is 293 \Index{less polymorphic} by binding values to one or more of its \Index{inferred parameter}. Any 294 value that is legal for the inferred parameter may be used, including other inferred parameters. 295 296 If, after the inferred parameter binding, an \Index{assertion parameter} has no inferred parameters 297 in its type, then an object or function must be visible at the point of the specialization that has 298 the same identifier as the assertion parameter and has a type that is compatible\index{compatible 299 type} with or can be specialized to the type of the assertion parameter. The assertion parameter 300 is bound to that object or function. 285 301 286 302 The type of the specialization is the type of the original with the bound inferred parameters and … … 325 341 \item 326 342 from a pointer to a structure or union type to a pointer to the type of a member of the structure or 327 union that is an anonymous structure\index{anonymous structure} or an anonymous 328 union\index{anonymous union}; 329 \item 330 within the scope of an initialized type declaration\index{type declaration}, conversions between a 331 type and its implementation or between a pointer to a type and a pointer to its implementation. 343 union that is an \Index{anonymous structure} or an \Index{anonymous union}; 344 \item 345 within the scope of an initialized \Index{type declaration}, conversions between a type and its 346 implementation or between a pointer to a type and a pointer to its implementation. 332 347 \end{itemize} 333 348 334 Conversions that are not safe conversions are \define{unsafe conversion s}.349 Conversions that are not safe conversions are \define{unsafe conversion}s. 335 350 \begin{rationale} 336 351 As in C, there is an implicit conversion from \lstinline$void *$ to any pointer type. This is … … 343 358 \subsection{Conversion cost} 344 359 345 The \define{conversion cost} of a safe\index{safe conversion s}346 conversion\footnote{Unsafe\index{unsafe conversion s} conversions do not have defined conversion360 The \define{conversion cost} of a safe\index{safe conversion} 361 conversion\footnote{Unsafe\index{unsafe conversion} conversions do not have defined conversion 347 362 costs.} is a measure of how desirable or undesirable it is. It is defined as follows. 348 363 \begin{itemize} … … 395 410 \subsection{Identifiers} 396 411 397 \CFA allows operator overloading\index{overloading} by associating operators with special398 function identifiers. Furthermore, the constants ``\lstinline$0$'' and ``\lstinline$1$'' have 399 special status for many of C's data types (and for many programmerdefined data types as well), so 400 \CFA treats them as overloadable identifiers. Programmers can use these identifiers to declare 401 functions and objectsthat implement operators and constants for their own types.412 \CFA allows operator \Index{overloading} by associating operators with special function 413 identifiers. Furthermore, the constants ``\lstinline$0$'' and ``\lstinline$1$'' have special status 414 for many of C's data types (and for many programmerdefined data types as well), so \CFA treats them 415 as overloadable identifiers. Programmers can use these identifiers to declare functions and objects 416 that implement operators and constants for their own types. 402 417 403 418 … … 561 576 562 577 \section{Expressions} 578 563 579 \CFA allows operators and identifiers to be overloaded. Hence, each expression can have a number 564 of \define{interpretation s}, each of which has a different type. The interpretations that are565 potentially executable are called \define{valid interpretation s}. The set of interpretations580 of \define{interpretation}s, each of which has a different type. The interpretations that are 581 potentially executable are called \define{valid interpretation}s. The set of interpretations 566 582 depends on the kind of expression and on the interpretations of the subexpressions that it contains. 567 583 The rules for determining the valid interpretations of an expression are discussed below for each … … 575 591 576 592 The \define{best valid interpretations} are the valid interpretations that use the fewest 577 unsafe\index{unsafe conversion s} conversions. Of these, the best are those where the functions and593 unsafe\index{unsafe conversion} conversions. Of these, the best are those where the functions and 578 594 objects involved are the least polymorphic\index{less polymorphic}. Of these, the best have the 579 lowest total conversion cost\index{conversion cost}, including all implicit conversions in the580 argument expressions. Of these, the best have the highest total conversion cost for the implicit 581 conversions (if any) applied to the argument expressions. If there is no single best valid 582 interpretation, or if the best valid interpretation is ambiguous, then the resulting interpretation 583 isambiguous\index{ambiguous interpretation}.595 lowest total \Index{conversion cost}, including all implicit conversions in the argument 596 expressions. Of these, the best have the highest total conversion cost for the implicit conversions 597 (if any) applied to the argument expressions. If there is no single best valid interpretation, or if 598 the best valid interpretation is ambiguous, then the resulting interpretation is 599 ambiguous\index{ambiguous interpretation}. 584 600 585 601 \begin{rationale} … … 595 611 The ``least polymorphic'' rule reduces the number of polymorphic function calls, since such 596 612 functions are presumably more expensive than monomorphic functions and since the more specific 597 function is presumably more appropriate. It also gives preference to monomorphic values (such as 598 the \lstinline$int$ \lstinline$0$) over polymorphic values (such as the null pointer 599 \lstinline$0$ )\use{0}\index{null pointer}. However, interpretations that call polymorphic functions600 are preferred to interpretations that perform unsafe conversions, because those conversions 601 potentially lose accuracyor violate strong typing.613 function is presumably more appropriate. It also gives preference to monomorphic values (such as the 614 \lstinline$int$ \lstinline$0$) over polymorphic values (such as the \Index{null pointer} 615 \lstinline$0$\use{0}). However, interpretations that call polymorphic functions are preferred to 616 interpretations that perform unsafe conversions, because those conversions potentially lose accuracy 617 or violate strong typing. 602 618 603 619 There are two notable differences between \CFA's overload resolution rules and the rules for … … 614 630 by \define{rewrite rules}. Each operator has a set of predefined functions that overload its 615 631 identifier. Overload resolution determines which member of the set is executed in a given 616 expression. The functions have internal linkage\index{internal linkage} and are implicitly declared617 with file scope\index{file scope}. The predefined functions and rewrite rules are discussed below 618 for each of theseoperators.632 expression. The functions have \Index{internal linkage} and are implicitly declared with \Index{file 633 scope}. The predefined functions and rewrite rules are discussed below for each of these 634 operators. 619 635 \begin{rationale} 620 636 Predefined functions and constants have internal linkage because that simplifies optimization in … … 629 645 of its subexpressions, this chapter can be taken as describing an overload resolution algorithm that 630 646 uses one bottomup pass over an expression tree. Such an algorithm was first described (for Ada) by 631 Baker 632 conversions. The overload resolution rules and the predefined functions have been chosen so that, 633 in programs that do not introduce overloaded declarations, expressions will have the same meaning in 634 Cand in \CFA.647 Baker~\cite{Bak:overload}. It is extended here to handle polymorphic functions and arithmetic 648 conversions. The overload resolution rules and the predefined functions have been chosen so that, in 649 programs that do not introduce overloaded declarations, expressions will have the same meaning in C 650 and in \CFA. 635 651 \end{rationale} 636 652 … … 641 657 \end{rationale} 642 658 659 643 660 \subsection{Primary expressions} 661 644 662 \begin{syntax} 645 663 \lhs{primaryexpression} … … 660 678 661 679 \semantics 662 The valid interpretations\index{valid interpretations} of an \nonterm{identifier} are given by the663 visible\index{visible}declarations of the identifier.680 The \Index{valid interpretation} of an \nonterm{identifier} are given by the visible\index{visible} 681 declarations of the identifier. 664 682 665 683 A \nonterm{constant} or \nonterm{stringliteral} has one valid interpretation, which has the type … … 702 720 \end{rationale} 703 721 722 704 723 \subsubsection{Generic selection} 724 705 725 \constraints The best interpretation of the controlling expression shall be 706 726 unambiguous\index{ambiguous interpretation}, and shall have type compatible with at most one of the … … 742 762 \end{lstlisting} 743 763 764 744 765 \subsubsection{Array subscripting} 766 745 767 \begin{lstlisting} 746 768 forall( type T ) lvalue T ?[?]( T *, ptrdiff_t );@\use{ptrdiff_t}@ … … 794 816 795 817 Each combination of function designators and argument interpretations is considered. For those 796 interpretations of the \nonterm{postfixexpression} that are monomorphic\index{monomorphic function}797 function designators, the combination has a valid interpretation\index{valid interpretations} if the 798 function designator accepts the number of arguments given, and each argument interpretation matches 799 the corresponding explicitparameter:818 interpretations of the \nonterm{postfixexpression} that are \Index{monomorphic function} 819 designators, the combination has a \Index{valid interpretation} if the function designator accepts 820 the number of arguments given, and each argument interpretation matches the corresponding explicit 821 parameter: 800 822 \begin{itemize} 801 823 \item … … 805 827 \item 806 828 if the function designator's type does not include a prototype or if the argument corresponds to 807 ``\lstinline$...$'' in a prototype, a default argument promotion\index{default argument promotions} 808 is applied to it. 829 ``\lstinline$...$'' in a prototype, a \Index{default argument promotion} is applied to it. 809 830 \end{itemize} 810 831 The type of the valid interpretation is the return type of the function designator. 811 832 812 833 For those combinations where the interpretation of the \nonterm{postfixexpression} is a 813 polymorphic\index{polymorphic function} function designator and the function designator accepts the 814 number of arguments given, there shall be at least one set of \define{implicit arguments} for the 815 implicit parameterssuch that834 \Index{polymorphic function} designator and the function designator accepts the number of arguments 835 given, there shall be at least one set of \define{implicit argument}s for the implicit parameters 836 such that 816 837 \begin{itemize} 817 838 \item 818 If the declaration of the implicit parameter uses typeclass\index{typeclass}819 \lstinline$type$\use{type}, the implicit argument must be an object type; if it uses 820 \lstinline$dtype$, the implicit argument must be an object type or an incomplete type; and if it821 uses \lstinline$ftype$, the implicit argumentmust be a function type.839 If the declaration of the implicit parameter uses \Index{typeclass} \lstinline$type$\use{type}, the 840 implicit argument must be an object type; if it uses \lstinline$dtype$, the implicit argument must 841 be an object type or an incomplete type; and if it uses \lstinline$ftype$, the implicit argument 842 must be a function type. 822 843 823 844 \item 824 845 if an explicit parameter's type uses any implicit parameters, then the corresponding explicit 825 argument must have a type that is (or can be safely converted\index{safe conversion s} to) the type846 argument must have a type that is (or can be safely converted\index{safe conversion} to) the type 826 847 produced by substituting the implicit arguments for the implicit parameters in the explicit 827 848 parameter type. … … 832 853 833 854 \item 834 for each assertion parameter\index{assertion parameters} in the function designator's type, there835 must be an object or function with the same identifier that is visible at the call site and whose 836 type is compatible withor can be specialized to the type of the assertion declaration.855 for each \Index{assertion parameter} in the function designator's type, there must be an object or 856 function with the same identifier that is visible at the call site and whose type is compatible with 857 or can be specialized to the type of the assertion declaration. 837 858 \end{itemize} 838 859 There is a valid interpretation for each such set of implicit parameters. The type of each valid … … 848 869 Every set of valid interpretations that have mutually compatible\index{compatible type} result types 849 870 also produces an interpretation of the function call expression. The type of the interpretation is 850 the composite\index{composite type} type of the types of the valid interpretations, and the value of851 the interpretation is that of the best valid interpretation\index{best valid interpretations}.871 the \Index{composite type} of the types of the valid interpretations, and the value of the 872 interpretation is that of the \Index{best valid interpretation}. 852 873 \begin{rationale} 853 874 One desirable property of a polymorphic programming language is \define{generalizability}: the … … 858 879 859 880 \CFA\index{deficiencies!generalizability} does not fully possess this property, because 860 unsafe\index{unsafe conversions} conversions are not done when arguments are passed to polymorphic 861 parameters.Consider881 \Index{unsafe conversion} are not done when arguments are passed to polymorphic parameters. 882 Consider 862 883 \begin{lstlisting} 863 884 float g( float, float ); … … 960 981 r( 0 ); 961 982 \end{lstlisting} 962 The \lstinline$int 0$ could be passed to (8), or the \lstinline$(void *)$ 963 specialization\index{specialization} of the null pointer\index{null pointer} \lstinline$0$\use{0} 964 c ould be passed to (9). The former is chosen because the \lstinline$int$ \lstinline$0$ is less965 polymorphic\index{less polymorphic}. For the same reason, \lstinline$int$ \lstinline$0$ is passed 966 to \lstinline$r()$, even though it has\emph{no} declared parameter types.983 The \lstinline$int 0$ could be passed to (8), or the \lstinline$(void *)$ \Index{specialization} of 984 the null pointer\index{null pointer} \lstinline$0$\use{0} could be passed to (9). The former is 985 chosen because the \lstinline$int$ \lstinline$0$ is \Index{less polymorphic}. For 986 the same reason, \lstinline$int$ \lstinline$0$ is passed to \lstinline$r()$, even though it has 987 \emph{no} declared parameter types. 967 988 968 989 … … 972 993 least one interpretation of \lstinline$s$ whose type is a structure type or union type containing a 973 994 member named \lstinline$m$. If two or more interpretations of \lstinline$s$ have members named 974 \lstinline$m$ with mutually compatible types, then the expression has an ambiguous975 interpretation \index{ambiguous interpretation} whose type is the composite type of the types of the976 members. If an interpretation of \lstinline$s$ has a member \lstinline$m$ whose type is not 977 compatible with any other \lstinline$s$'s \lstinline$m$, then the expression has an interpretation 978 with the member's type. Theexpression has no other interpretations.995 \lstinline$m$ with mutually compatible types, then the expression has an \Index{ambiguous 996 interpretation} whose type is the composite type of the types of the members. If an interpretation 997 of \lstinline$s$ has a member \lstinline$m$ whose type is not compatible with any other 998 \lstinline$s$'s \lstinline$m$, then the expression has an interpretation with the member's type. The 999 expression has no other interpretations. 979 1000 980 1001 The expression ``\lstinline$p>m$'' has the same interpretations as the expression … … 1147 1168 \begin{lstlisting} 1148 1169 X ?++( volatile X * ), ?++( _Atomic volatile X * ), 1149 ?( volatile X * ), ?( _Atomic volatile X * );1170 ?( volatile X * ), ?( _Atomic volatile X * ); 1150 1171 \end{lstlisting} 1151 1172 For every complete enumerated type \lstinline$E$ there exist … … 1153 1174 \begin{lstlisting} 1154 1175 E ?++( volatile E * ), ?++( _Atomic volatile E * ), 1155 ?( volatile E * ), ?( _Atomic volatile E * );1176 ?( volatile E * ), ?( _Atomic volatile E * ); 1156 1177 \end{lstlisting} 1157 1178 … … 1174 1195 First, each interpretation of the operand of an increment or decrement expression is considered 1175 1196 separately. For each interpretation that is a bitfield or is declared with the 1176 \lstinline$register$\index{register@{\lstinline$register$}} storageclass1177 specifier\index{storageclass specifier}, the expression has one valid interpretation, with the type 1178 of the operand, and the expression isambiguous if the operand is.1197 \lstinline$register$\index{register@{\lstinline$register$}} \index{Itorageclass specifier}, the 1198 expression has one valid interpretation, with the type of the operand, and the expression is 1199 ambiguous if the operand is. 1179 1200 1180 1201 For the remaining interpretations, the expression is rewritten, and the interpretations of the … … 1523 1544 \constraints 1524 1545 The operand of the unary ``\lstinline$&$'' operator shall have exactly one 1525 interpretation\index{ambiguous interpretation}\index{interpretations}, which shall be unambiguous.1546 \Index{interpretation}\index{ambiguous interpretation}, which shall be unambiguous. 1526 1547 1527 1548 \semantics … … 1596 1617 forall( ftype FT ) int !?( FT * ); 1597 1618 \end{lstlisting} 1598 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion1599 rank }greater than the rankof \lstinline$int$ there exist1619 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 1620 rank of \lstinline$int$ there exist 1600 1621 % Don't use predefined: keep this out of prelude.cf. 1601 1622 \begin{lstlisting} … … 1660 1681 1661 1682 1662 \subsubsection{The {\tt sizeof} and {\tt \_Alignof}operators}1683 \subsubsection{The \lstinline$sizeof$ and \lstinline$_Alignof$ operators} 1663 1684 1664 1685 \constraints … … 1667 1688 1668 1689 When the \lstinline$sizeof$\use{sizeof} operator is applied to an expression, the expression shall 1669 have exactly one interpretation\index{ambiguous interpretation}\index{interpretations}, which shall1690 have exactly one \Index{interpretation}\index{ambiguous interpretation}, which shall 1670 1691 be unambiguous. \semantics A \lstinline$sizeof$ or \lstinline$_Alignof$ expression has one 1671 1692 interpretation, of type \lstinline$size_t$. … … 1697 1718 \end{rationale} 1698 1719 1720 1699 1721 \subsection{Cast operators} 1722 1700 1723 \begin{syntax} 1701 1724 \lhs{castexpression} … … 1710 1733 \semantics 1711 1734 1712 In a cast expression\index{cast expression} ``\lstinline$($\nonterm{typename}\lstinline$)e$'', if1713 \nonterm{typename} is the type of an interpretation of \lstinline$e$, then that interpretation is the1714 only interpretation of the cast expression; otherwise, \lstinline$e$ shall have some interpretation that 1715 can be converted to \nonterm{typename}, and the interpretation of the cast expression isthe cast1716 of the interpretation that can be converted at the lowest cost. The cast expression's interpretation 1717 is ambiguous\index{ambiguous interpretation} if more than one interpretation can be converted at the1718 lowest cost or if the selected interpretation is ambiguous.1735 In a \Index{cast expression} ``\lstinline$($\nonterm{typename}\lstinline$)e$'', if 1736 \nonterm{typename} is the type of an interpretation of \lstinline$e$, then that interpretation is 1737 the only interpretation of the cast expression; otherwise, \lstinline$e$ shall have some 1738 interpretation that can be converted to \nonterm{typename}, and the interpretation of the cast 1739 expression is the cast of the interpretation that can be converted at the lowest cost. The cast 1740 expression's interpretation is ambiguous\index{ambiguous interpretation} if more than one 1741 interpretation can be converted at the lowest cost or if the selected interpretation is ambiguous. 1719 1742 1720 1743 \begin{rationale} … … 1723 1746 \end{rationale} 1724 1747 1748 1725 1749 \subsection{Multiplicative operators} 1750 1726 1751 \begin{syntax} 1727 1752 \lhs{multiplicativeexpression} … … 1783 1808 ?/?( _Complex long double, _Complex long double ); 1784 1809 \end{lstlisting} 1785 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion1786 rank }greater than the rankof \lstinline$int$ there exist1810 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 1811 rank of \lstinline$int$ there exist 1787 1812 % Don't use predefined: keep this out of prelude.cf. 1788 1813 \begin{lstlisting} … … 1791 1816 1792 1817 \begin{rationale} 1793 {\c11} does not include conversions from the real types\index{real type} to complex 1794 types\index{complex type} in the usual arithmetic conversions\index{usual arithmetic conversions}. 1795 Instead it specifies conversion of the result of binary operations on arguments from mixed type 1796 domains. \CFA's predefined operators match that pattern. 1818 {\c11} does not include conversions from the \Index{real type}s to \Index{complex type}s in the 1819 \Index{usual arithmetic conversion}s. Instead it specifies conversion of the result of binary 1820 operations on arguments from mixed type domains. \CFA's predefined operators match that pattern. 1797 1821 \end{rationale} 1798 1822 … … 1829 1853 1830 1854 \begin{rationale} 1831 {\c11} defines most arithmetic operations to apply an integer promotion\index{integer promotions} to 1832 any argument that belongs to a type that has an integer conversion rank\index{integer conversion 1833 rank} less than that of \lstinline$int$.If \lstinline$s$ is a \lstinline$short int$, 1834 ``\lstinline$s *s$'' does not have type \lstinline$short int$; it is treated as 1835 ``\lstinline$( (int)s ) * ( (int)s )$'', and has type \lstinline$int$. \CFA matches that pattern; 1836 it does not predefine ``\lstinline$short ?*?( short, short )$''. 1855 {\c11} defines most arithmetic operations to apply an \Index{integer promotion} to any argument that 1856 belongs to a type that has an \Index{integer conversion rank} less than that of \lstinline$int$.If 1857 \lstinline$s$ is a \lstinline$short int$, ``\lstinline$s *s$'' does not have type \lstinline$short int$; 1858 it is treated as ``\lstinline$( (int)s ) * ( (int)s )$'', and has type \lstinline$int$. \CFA matches 1859 that pattern; it does not predefine ``\lstinline$short ?*?( short, short )$''. 1837 1860 1838 1861 These ``missing'' operators limit polymorphism. Consider … … 1986 2009 * ??( _Atomic const restrict volatile T *, _Atomic const restrict volatile T * ); 1987 2010 \end{lstlisting} 1988 For every extended integer type \lstinline$X$ with integer conversion rank 1989 \index{integer conversion rank}greater than the rank of \lstinline$int$ there 1990 exist 2011 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2012 rank of \lstinline$int$ there exist 1991 2013 % Don't use predefined: keep this out of prelude.cf. 1992 2014 \begin{lstlisting} … … 2039 2061 ?>>?( long long unsigned int, int); 2040 2062 \end{lstlisting} 2041 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2042 rank}greater than therank of \lstinline$int$ there exist2063 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2064 rank of \lstinline$int$ there exist 2043 2065 % Don't use predefined: keep this out of prelude.cf. 2044 2066 \begin{lstlisting} … … 2048 2070 \begin{rationale} 2049 2071 The bitwise shift operators break the usual pattern: they do not convert both operands to a common 2050 type. The right operand only undergoes integer promotion\index{integer promotion}.2072 type. The right operand only undergoes \Index{integer promotion}. 2051 2073 \end{rationale} 2052 2074 … … 2123 2145 ?>=?( _Atomic const restrict volatile DT *, _Atomic const restrict volatile DT * ); 2124 2146 \end{lstlisting} 2125 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2126 rank}greater than therank of \lstinline$int$ there exist2147 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2148 rank of \lstinline$int$ there exist 2127 2149 % Don't use predefined: keep this out of prelude.cf. 2128 2150 \begin{lstlisting} … … 2226 2248 ?!=?( forall( ftype FT2) FT2*, forall( ftype FT3) FT3 * ); 2227 2249 \end{lstlisting} 2228 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2229 rank}greater than therank of \lstinline$int$ there exist2250 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2251 rank of \lstinline$int$ there exist 2230 2252 % Don't use predefined: keep this out of prelude.cf. 2231 2253 \begin{lstlisting} … … 2237 2259 The polymorphic equality operations come in three styles: comparisons between pointers of compatible 2238 2260 types, between pointers to \lstinline$void$ and pointers to object types or incomplete types, and 2239 between the null pointer constant\index{null pointer} and pointers to any type. In the last case, a2240 special constraint rule for null pointer constant operands has been replaced by a consequence of the 2241 \CFAtype system.2261 between the \Index{null pointer} constant and pointers to any type. In the last case, a special 2262 constraint rule for null pointer constant operands has been replaced by a consequence of the \CFA 2263 type system. 2242 2264 \end{rationale} 2243 2265 … … 2278 2300 long long unsigned int ?&?( long long unsigned int, long long unsigned int ); 2279 2301 \end{lstlisting} 2280 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2281 rank }greater than the rankof \lstinline$int$ there exist2302 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2303 rank of \lstinline$int$ there exist 2282 2304 % Don't use predefined: keep this out of prelude.cf. 2283 2305 \begin{lstlisting} … … 2311 2333 long long unsigned int ?^?( long long unsigned int, long long unsigned int ); 2312 2334 \end{lstlisting} 2313 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2314 rank}greater than therank of \lstinline$int$ there exist2335 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2336 rank of \lstinline$int$ there exist 2315 2337 % Don't use predefined: keep this out of prelude.cf. 2316 2338 \begin{lstlisting} … … 2344 2366 long long unsigned int ??( long long unsigned int, long long unsigned int ); 2345 2367 \end{lstlisting} 2346 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion2347 rank }greater than the rankof \lstinline$int$ there exist2368 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2369 rank of \lstinline$int$ there exist 2348 2370 % Don't use predefined: keep this out of prelude.cf. 2349 2371 \begin{lstlisting} … … 2502 2524 2503 2525 \begin{rationale} 2504 The object of the above is to apply the usual arithmetic conversions\index{usual arithmetic2505 conversions} when the second and third operands have arithmetic type, and to combine the 2506 qualifiers of the second and third operandsif they are pointers.2526 The object of the above is to apply the \Index{usual arithmetic conversion}s when the second and 2527 third operands have arithmetic type, and to combine the qualifiers of the second and third operands 2528 if they are pointers. 2507 2529 \end{rationale} 2508 2530 … … 3172 3194 3173 3195 \constraints 3174 If an identifier has no linkage\index{no linkage}, there shall be no more than one declaration of3175 the identifier ( in a declarator or type specifier ) with compatible types in the same scope and in 3176 thesame name space, except that:3196 If an identifier has \Index{no linkage}, there shall be no more than one declaration of the 3197 identifier ( in a declarator or type specifier ) with compatible types in the same scope and in the 3198 same name space, except that: 3177 3199 \begin{itemize} 3178 3200 \item … … 3276 3298 \semantics 3277 3299 The \nonterm{typeparameterlist}s and assertions of the \nonterm{forallspecifier}s declare type 3278 identifiers, function and object identifiers with no linkage\index{no linkage}.3300 identifiers, function and object identifiers with \Index{no linkage}. 3279 3301 3280 3302 If, in the declaration ``\lstinline$T D1$'', \lstinline$T$ contains \nonterm{forallspecifier}s and … … 3284 3306 \end{lstlisting} 3285 3307 then a type identifier declared by one of the \nonterm{forallspecifier}s is an \define{inferred 3286 3308 parameter} of the function declarator if and only if it is not an inferred parameter of a function 3287 3309 declarator in \lstinline$D$, and it is used in the type of a parameter in the following 3288 3310 \nonterm{typeparameterlist} or it and an inferred parameter are used as arguments of a 3289 specification\index{specification} in one of the \nonterm{forallspecifier}s. The identifiers 3290 declared by assertions that use an inferred parameter of a function declarator are assertion 3291 parameters\index{assertion parameters}of that function declarator.3311 \Index{specification} in one of the \nonterm{forallspecifier}s. The identifiers declared by 3312 assertions that use an inferred parameter of a function declarator are \Index{assertion parameter}s 3313 of that function declarator. 3292 3314 \begin{rationale} 3293 3315 Since every inferred parameter is used by some parameter, inference can be understood as a single … … 3312 3334 3313 3335 If a function declarator is part of a function definition, its inferred parameters and assertion 3314 parameters have block scope\index{block scope}; otherwise, identifiers declared by assertions have a3336 parameters have \Index{block scope}; otherwise, identifiers declared by assertions have a 3315 3337 \define{declaration scope}, which terminates at the end of the \nonterm{declaration}. 3316 3338 … … 3326 3348 and $g$ in their order of occurance in the function types' \nonterm{parametertypelist}s. Let $f'$ 3327 3349 be $f$ with every occurrence of $f_i$ replaced by $g_i$, for all $i$. Then $f$ and $g$ are 3328 compatible types\index{compatible type} if $f'$'s and $g$'s return types and parameter lists are 3329 compatible, and if for every assertion parameter of $f'$ there is an assertion parameter in $g$ with 3330 the sameidentifier and compatible type, and vice versa.3350 \Index{compatible type}s if $f'$'s and $g$'s return types and parameter lists are compatible, and if 3351 for every assertion parameter of $f'$ there is an assertion parameter in $g$ with the same 3352 identifier and compatible type, and vice versa. 3331 3353 3332 3354 \examples … … 3438 3460 \lstinline$lvalue$ may be used to qualify the return type of a function type. Let \lstinline$T$ be 3439 3461 an unqualified version of a type; then the result of calling a function with return type 3440 \lstinline$lvalue T$ is a modifiable lvalue\index{modifiable lvalue} of type \lstinline$T$.3462 \lstinline$lvalue T$ is a \Index{modifiable lvalue} of type \lstinline$T$. 3441 3463 \lstinline$const$\use{const} and \lstinline$volatile$\use{volatile} qualifiers may also be added to 3442 3464 indicate that the function result is a constant or volatile lvalue. … … 3446 3468 \end{rationale} 3447 3469 3448 An {lvalue}qualified type may be used in a cast expression\index{cast expression} if the operand is3449 an lvalue; theresult of the expression is an lvalue.3470 An {lvalue}qualified type may be used in a \Index{cast expression} if the operand is an lvalue; the 3471 result of the expression is an lvalue. 3450 3472 3451 3473 \begin{rationale} … … 3490 3512 3491 3513 \item 3492 References to constqualified\index{constqualified} types can be used instead of value parameters.3493 Given the {\CC} function call ``\lstinline$fiddle( a_thing )$'', where the type of 3494 \lstinline$ a_thing$ is \lstinline$Thing$, the type of \lstinline$fiddle$ could be either of3514 References to \Index{constqualified} types can be used instead of value parameters. Given the 3515 {\CC} function call ``\lstinline$fiddle( a_thing )$'', where the type of \lstinline$a_thing$ is 3516 \lstinline$Thing$, the type of \lstinline$fiddle$ could be either of 3495 3517 \begin{lstlisting} 3496 3518 void fiddle( Thing ); … … 3525 3547 object being initialized. An expression used in an \nonterm{initializerlist} is treated as being 3526 3548 cast to the type of the aggregate member that it initializes. In either case the cast must have a 3527 single unambiguous interpretation\index{interpretations}.3549 single unambiguous \Index{interpretation}. 3528 3550 3529 3551 … … 3547 3569 \begin{rationale} 3548 3570 The declarations allowed in a specification are much the same as those allowed in a structure, 3549 except that bit fields are not allowed, and incomplete types\index{incomplete types} and function 3550 types are allowed. 3571 except that bit fields are not allowed, and \Index{incomplete type}s and function types are allowed. 3551 3572 \end{rationale} 3552 3573 … … 3563 3584 3564 3585 \subsubsection{Assertions} 3586 3565 3587 \begin{syntax} 3566 3588 \lhs{assertionlist} … … 3580 3602 each \nonterm{typeparameter} in that specification's \nonterm{specparameterlist}. If the 3581 3603 \nonterm{typeparameter} uses typeclass \lstinline$type$\use{type}, the argument shall be the type 3582 name of an object type\index{object types}; if it uses \lstinline$dtype$, the argument shall be the3583 type name of an object type or an incomplete type\index{incomplete types}; and if it uses 3584 \lstinline$ftype$, the argument shall be the type name of a function type\index{function types}.3604 name of an \Index{object type}; if it uses \lstinline$dtype$, the argument shall be the type name of 3605 an object type or an \Index{incomplete type}; and if it uses \lstinline$ftype$, the argument shall 3606 be the type name of a \Index{function type}. 3585 3607 3586 3608 \semantics … … 3595 3617 combining the declarations produced by each assertion. If the collection contains two declarations 3596 3618 that declare the same identifier and have compatible types, they are combined into one declaration 3597 with the composite type\index{composite type} constructed from the two types.3619 with the \Index{composite type} constructed from the two types. 3598 3620 3599 3621 \examples … … 3630 3652 \end{lstlisting} 3631 3653 3654 3632 3655 \subsection{Type declarations} 3656 3633 3657 \begin{syntax} 3634 3658 \lhs{typeparameterlist} … … 3656 3680 3657 3681 \semantics 3658 A \nonterm{typeparameter} or a \nonterm{typedeclarator} declares an identifier to be a type 3659 name\index{type names} for a type incompatible with all other types. 3660 3661 An identifier declared by a \nonterm{typeparameter} has no linkage\index{no linkage}. Identifiers 3662 declared with typeclass \lstinline$type$\use{type} are object types\index{object types}; those 3663 declared with typeclass \lstinline$dtype$\use{dtype} are incomplete types\index{incomplete types}; 3664 and those declared with typeclass \lstinline$ftype$\use{ftype} are function types\index{function 3665 types}. The identifier has block scope\index{block scope} that terminates at the end of the 3666 \nonterm{specdeclarationlist} or polymorphic function that contains the \nonterm{typeparameter}. 3667 3668 A \nonterm{typedeclarator} with an initializer\index{initializer} is a \define{type definition}. 3669 The declared identifier is an incomplete type\index{incomplete types} within the initializer, and an 3670 object type\index{object types} after the end of the initializer. The type in the initializer is 3671 called the \define{implementation type}. Within the scope of the declaration, implicit 3672 conversions\index{implicit conversions} can be performed between the defined type and the 3673 implementation type, and between pointers to the defined type and pointers to the implementation 3674 type. 3675 3676 A type declaration without an initializer\index{initializer} and without a storageclass 3677 specifier\index{storageclass specifiers} or with storageclass specifier 3678 \lstinline$static$\use{static} defines an incomplete type\index{incomplete types}. If a translation 3679 unit\index{translation unit} or block \index{block} contains one or more such declarations for an 3680 identifier, it must contain exactly one definition of the identifier ( but not in an enclosed block, 3681 which would define a new type known only within that block). 3682 A \nonterm{typeparameter} or a \nonterm{typedeclarator} declares an identifier to be a \Index{type 3683 name} for a type incompatible with all other types. 3684 3685 An identifier declared by a \nonterm{typeparameter} has \Index{no linkage}. Identifiers declared 3686 with typeclass \lstinline$type$\use{type} are \Index{object type}s; those declared with typeclass 3687 \lstinline$dtype$\use{dtype} are \Index{incomplete type}s; and those declared with typeclass 3688 \lstinline$ftype$\use{ftype} are \Index{function type}s. The identifier has \Index{block scope} that 3689 terminates at the end of the \nonterm{specdeclarationlist} or polymorphic function that contains 3690 the \nonterm{typeparameter}. 3691 3692 A \nonterm{typedeclarator} with an \Index{initializer} is a \define{type definition}. The declared 3693 identifier is an \Index{incomplete type} within the initializer, and an \Index{object type} after 3694 the end of the initializer. The type in the initializer is called the \define{implementation 3695 type}. Within the scope of the declaration, \Index{implicit conversion}s can be performed between 3696 the defined type and the implementation type, and between pointers to the defined type and pointers 3697 to the implementation type. 3698 3699 A type declaration without an \Index{initializer} and without a \Index{storageclass specifier} or 3700 with storageclass specifier \lstinline$static$\use{static} defines an \Index{incomplete type}. If a 3701 \Index{translation unit} or \Index{block} contains one or more such declarations for an identifier, 3702 it must contain exactly one definition of the identifier ( but not in an enclosed block, which would 3703 define a new type known only within that block). 3682 3704 \begin{rationale} 3683 3705 Incomplete type declarations allow compact mutuallyrecursive types. … … 3698 3720 \end{rationale} 3699 3721 3700 A type declaration without an initializer and with storageclass specifier \index{storageclass3701 specifiers} \lstinline$extern$\use{extern} is an \define{opaque type declaration}. Opaque types 3702 are object types\index{object types}. An opaque type is not a \nonterm{constantexpression}; 3703 neither is a structure or union that has a member whose type is not a \nonterm{constantexpression}. 3704 Every other object type\index{object types} is a \nonterm{constantexpression}. Objects with static 3705 storage duration shallbe declared with a type that is a \nonterm{constantexpression}.3722 A type declaration without an initializer and with \Index{storageclass specifier} 3723 \lstinline$extern$\use{extern} is an \define{opaque type declaration}. Opaque types are 3724 \Index{object type}s. An opaque type is not a \nonterm{constantexpression}; neither is a structure 3725 or union that has a member whose type is not a \nonterm{constantexpression}. Every other 3726 \Index{object type} is a \nonterm{constantexpression}. Objects with static storage duration shall 3727 be declared with a type that is a \nonterm{constantexpression}. 3706 3728 \begin{rationale} 3707 3729 Type declarations can declare identifiers with external linkage, whereas typedef declarations … … 3714 3736 \end{rationale} 3715 3737 3716 An incomplete type\index{incomplete types} which is not a qualified version\index{qualified type} of 3717 a type is a value of typeclass\index{typeclass} \lstinline$dtype$. An object type\index{object 3718 types} which is not a qualified version of a type is a value of typeclasses \lstinline$type$ and 3719 \lstinline$dtype$. A function type\index{function types} is a value of typeclass 3720 \lstinline$ftype$. 3738 An \Index{incomplete type} which is not a qualified version\index{qualified type} of a type is a 3739 value of \Index{typeclass} \lstinline$dtype$. An object type\index{object types} which is not a 3740 qualified version of a type is a value of typeclasses \lstinline$type$ and \lstinline$dtype$. A 3741 \Index{function type} is a value of typeclass \lstinline$ftype$. 3721 3742 \begin{rationale} 3722 3743 Syntactically, a type value is a \nonterm{typename}, which is a declaration for an object which … … 3752 3773 3753 3774 \begin{rationale} 3754 Since incomplete types\index{incomplete types} are not type values, they can not be used as the3755 initializer in a type declaration, or as the type of a structure or union member. This prevents the 3756 declaration oftypes that contain each other.3775 Since \Index{incomplete type}s are not type values, they can not be used as the initializer in a 3776 type declaration, or as the type of a structure or union member. This prevents the declaration of 3777 types that contain each other. 3757 3778 \begin{lstlisting} 3758 3779 type t1; … … 3900 3921 A declaration\index{type declaration} of a type identifier \lstinline$T$ with typeclass 3901 3922 \lstinline$type$ implicitly declares a \define{default assignment} function 3902 \lstinline$T ?=?( T *, T )$\use{?=?}, with the same scope\index{scopes} and linkage\index{linkage} as3903 theidentifier \lstinline$T$.3923 \lstinline$T ?=?( T *, T )$\use{?=?}, with the same \Index{scope} and \Index{linkage} as the 3924 identifier \lstinline$T$. 3904 3925 \begin{rationale} 3905 3926 Assignment is central to C's imperative programming style, and every existing C object type has … … 3912 3933 \end{rationale} 3913 3934 3914 A definition\index{type definition} of a type identifier \lstinline$T$ with implementation3915 type \index{implementation type} \lstinline$I$ and typeclass \lstinline$type$ implicitly defines a3916 default assignment function. A definition\index{type definition} of a type identifier \lstinline$T$ 3917 with implementation type \lstinline$I$ and an assertion list implicitly defines \define{default 3918 functions} and \define{default objects} as declared by the assertion declarations. The default 3919 objects and functions have the same scope\index{scopes} and linkage\index{linkage} as the identifier3920 \lstinline$T$. Theirvalues are determined as follows:3935 A definition\index{type definition} of a type identifier \lstinline$T$ with \Index{implementation 3936 type} \lstinline$I$ and typeclass \lstinline$type$ implicitly defines a default assignment 3937 function. A definition\index{type definition} of a type identifier \lstinline$T$ with implementation 3938 type \lstinline$I$ and an assertion list implicitly defines \define{default function}s and 3939 \define{default object}s as declared by the assertion declarations. The default objects and 3940 functions have the same \Index{scope} and \Index{linkage} as the identifier \lstinline$T$. Their 3941 values are determined as follows: 3921 3942 \begin{itemize} 3922 3943 \item … … 4014 4035 4015 4036 \section{Statements and blocks} 4037 4016 4038 Many statements contain expressions, which may have more than one interpretation. The following 4017 sections describe how the \CFA translator selects an interpretation. In all cases the result of 4018 the selection shall be a single unambiguous interpretation\index{interpretations}.4039 sections describe how the \CFA translator selects an interpretation. In all cases the result of the 4040 selection shall be a single unambiguous \Index{interpretation}. 4019 4041 4020 4042 … … 4032 4054 \end{lstlisting} 4033 4055 may have more than one interpretation, but it shall have only one interpretation with an integral 4034 type. An integer promotion\index{integer promotion} is performed on the expression if necessary. 4035 The constant expressions in \lstinline$case$ statements with the switch are converted to the 4036 promoted type. 4056 type. An \Index{integer promotion} is performed on the expression if necessary. The constant 4057 expressions in \lstinline$case$ statements with the switch are converted to the promoted type. 4037 4058 4038 4059 … … 4080 4101 \appendix 4081 4102 4103 4082 4104 \chapter{Examples} 4105 4083 4106 4084 4107 \section{C types} … … 4183 4206 \end{lstlisting} 4184 4207 4185 Specifications that define the dereference operator ( or subscript operator ) require two parameters,4186 one for the pointer type and one for the pointedat ( or element ) type. Different specifications are 4187 needed for each set of type qualifiers\index{type qualifiers}, because qualifiers are not included 4188 in types. The assertion ``\lstinline$ptr_to( Safe_pointer, int )$'' should be read as4208 Specifications that define the dereference operator ( or subscript operator ) require two 4209 parameters, one for the pointer type and one for the pointedat ( or element ) type. Different 4210 specifications are needed for each set of \Index{type qualifier}s, because qualifiers are not 4211 included in types. The assertion ``\lstinline$ptr_to( Safe_pointer, int )$'' should be read as 4189 4212 ``\lstinline$Safe_pointer$ acts like a pointer to \lstinline$int$''. 4190 4213 \begin{lstlisting}
Note: See TracChangeset
for help on using the changeset viewer.