Changes in / [18387ef:76b48f1]
- Files:
-
- 3 edited
-
.gitignore (modified) (1 diff)
-
doc/refrat/Makefile (modified) (2 diffs)
-
doc/refrat/refrat.tex (modified) (77 diffs)
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r18387ef r76b48f1 27 27 # generated by bison and lex from cfa.yy and lex.ll, respectively 28 28 src/Parser/parser.output 29 30 # generated by latex31 doc/refrat/refrat.aux32 doc/refrat/refrat.bbl33 doc/refrat/refrat.blg34 doc/refrat/refrat.brf35 doc/refrat/refrat.dvi36 doc/refrat/refrat.idx37 doc/refrat/refrat.ilg38 doc/refrat/refrat.ind39 doc/refrat/refrat.log40 doc/refrat/refrat.out41 doc/refrat/refrat.pdf42 doc/refrat/refrat.ps43 doc/refrat/refrat.toc -
doc/refrat/Makefile
r18387ef r76b48f1 42 42 dvips $< -o $@ 43 43 44 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCE} ${basename ${DOCUMENT}}.bbl44 ${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCE} refrat.bbl ${basename ${DOCUMENT}}.tex ${basename ${DOCUMENT}}.idx ${basename ${DOCUMENT}}.bbl 45 45 ${LaTeX} ${basename $@}.tex 46 46 if fgrep -s "Label(s) may have changed" ${basename $@}.log ; then ${LaTeX} ${basename $@}.tex ; fi … … 49 49 ${LaTeX} ${basename $@}.tex % to get index title in toc 50 50 51 ${basename ${DOCUMENT}}.bbl : ${basename ${DOCUMENT}}.tex ${basename ${DOCUMENT}}.bib 52 if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi 51 ${basename ${DOCUMENT}}.idx : %.idx : %.tex 52 if [ ! -r ${basename $@}.ind ] ; then cp /dev/null ${basename $@}.ind ; fi 53 54 ${basename ${DOCUMENT}}.bbl : 53 55 if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi 54 56 -${BibTeX} ${basename $@} -
doc/refrat/refrat.tex
r18387ef r76b48f1 1 % requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended2 3 1 \documentclass[openright,twoside]{report} 4 2 \usepackage{fullpage,times} … … 57 55 \def\c11{ISO/IEC C}% cannot have numbers in latex command name 58 56 59 % replace/adjust characters that look bad in sanserif60 \makeatletter61 \lst@CCPutMacro62 \lst@ProcessOther{"2D}{\lst@ttfamily{-{}}{{\ttfamily\upshape -}}} % replace minus63 \lst@ProcessOther{"3C}{\lst@ttfamily{<}{\texttt{<}}} % replace less than64 \lst@ProcessOther{"3E}{\lst@ttfamily{<}{\texttt{>}}} % replace greater than65 \lst@ProcessOther{"5E}{$\sim$} % circumflex66 \lst@ProcessLetter{"5F}{\lst@ttfamily{\char95}{{\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}}}} % replace underscore67 \lst@ProcessOther{"7E}{\raisebox{-.4ex}[1ex][0pt]{\textasciitilde}} % lower tilde68 \@empty\z@\@empty69 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 \makeatother74 75 57 \lstdefinelanguage{CFA}[ANSI]{C}% 76 58 {morekeywords={asm,_Atomic,catch,choose,_Complex,context,dtype,fallthru,forall,ftype,_Imaginary,lvalue,restrict,throw,try,type,}, … … 89 71 90 72 \setcounter{secnumdepth}{3} % number subsubsections 91 \setcounter{tocdepth}{3} % subsubsections in table of contents92 73 \makeindex 93 74 … … 161 142 162 143 \CFA's scope rules differ from C's in one major respect: a declaration of an identifier may 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 pointed-at 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. 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 pointed-at 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. 170 152 \begin{rationale} 171 153 Hence, a \CFA program can declare an \lstinline$int v$ and a \lstinline$float v$ in the same … … 174 156 175 157 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 pointed-at 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} alwaysdenote unique entities.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 pointed-at 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. 188 170 \begin{rationale} 189 171 A \CFA program can declare an \lstinline$extern int v$ and an \lstinline$extern float v$; a C … … 193 175 \section{Conversions} 194 176 \CFA defines situations where values of one type are automatically converted to another type. 195 These conversions are called \define{implicit conversion }s. The programmer can request196 \define{explicit conversion }susing cast expressions.177 These conversions are called \define{implicit conversions}. The programmer can request 178 \define{explicit conversions} using cast expressions. 197 179 198 180 … … 202 184 203 185 \subsubsection{Safe arithmetic conversions} 204 In C, a pattern of conversions known as the \define{usual arithmetic conversion }sis used with most186 In C, a pattern of conversions known as the \define{usual arithmetic conversions} is used with most 205 187 binary arithmetic operators to convert the operands to a common type and determine the type of the 206 188 operator's result. In \CFA, these conversions play a role in overload resolution, and 207 collectively are called the \define{safe arithmetic conversion }s.189 collectively are called the \define{safe arithmetic conversions}. 208 190 209 191 Let \(int_r\) and \(unsigned_r\) be the signed and unsigned integer types with integer conversion 210 rank\index{integer conversion rank} \index{rank|see{integer conversion rank}} $r$. Let192 rank\index{integer conversion rank} \index{rank|see{integer conversion rank}} $r$. Let 211 193 \(unsigned_{mr}\) be the unsigned integer type with maximal rank. 212 194 … … 214 196 \begin{itemize} 215 197 \item 216 The \Index{integer promotion}s.198 The integer promotions\index{integer promotions}. 217 199 218 200 \item … … 252 234 253 235 \begin{rationale} 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. 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. 256 239 \end{rationale} 257 240 … … 265 248 266 249 If an expression's type is a pointer to a structure or union type that has a member that is an 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.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's type. The result of the conversion is a pointer to the member. 270 253 271 254 \examples … … 290 273 291 274 \subsubsection{Specialization} 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. 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. 301 285 302 286 The type of the specialization is the type of the original with the bound inferred parameters and … … 341 325 \item 342 326 from a pointer to a structure or union type to a pointer to the type of a member of the structure or 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. 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. 347 332 \end{itemize} 348 333 349 Conversions that are not safe conversions are \define{unsafe conversion }s.334 Conversions that are not safe conversions are \define{unsafe conversions}. 350 335 \begin{rationale} 351 336 As in C, there is an implicit conversion from \lstinline$void *$ to any pointer type. This is … … 358 343 \subsection{Conversion cost} 359 344 360 The \define{conversion cost} of a safe\index{safe conversion }361 conversion\footnote{Unsafe\index{unsafe conversion } conversions do not have defined conversion345 The \define{conversion cost} of a safe\index{safe conversions} 346 conversion\footnote{Unsafe\index{unsafe conversions} conversions do not have defined conversion 362 347 costs.} is a measure of how desirable or undesirable it is. It is defined as follows. 363 348 \begin{itemize} … … 410 395 \subsection{Identifiers} 411 396 412 \CFA allows operator \Index{overloading} by associating operators with special function413 identifiers. Furthermore, the constants ``\lstinline$0$'' and ``\lstinline$1$'' have special status 414 for many of C's data types (and for many programmer-defined 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.397 \CFA allows operator overloading\index{overloading} by associating operators with special 398 function identifiers. Furthermore, the constants ``\lstinline$0$'' and ``\lstinline$1$'' have 399 special status for many of C's data types (and for many programmer-defined data types as well), so 400 \CFA treats them as overloadable identifiers. Programmers can use these identifiers to declare 401 functions and objects that implement operators and constants for their own types. 417 402 418 403 … … 576 561 577 562 \section{Expressions} 578 579 563 \CFA allows operators and identifiers to be overloaded. Hence, each expression can have a number 580 of \define{interpretation }s, each of which has a different type. The interpretations that are581 potentially executable are called \define{valid interpretation }s. The set of interpretations564 of \define{interpretations}, each of which has a different type. The interpretations that are 565 potentially executable are called \define{valid interpretations}. The set of interpretations 582 566 depends on the kind of expression and on the interpretations of the subexpressions that it contains. 583 567 The rules for determining the valid interpretations of an expression are discussed below for each … … 591 575 592 576 The \define{best valid interpretations} are the valid interpretations that use the fewest 593 unsafe\index{unsafe conversion } conversions. Of these, the best are those where the functions and577 unsafe\index{unsafe conversions} conversions. Of these, the best are those where the functions and 594 578 objects involved are the least polymorphic\index{less polymorphic}. Of these, the best have the 595 lowest total \Index{conversion cost}, including all implicit conversions in the argument596 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}.579 lowest total conversion cost\index{conversion cost}, including all implicit conversions in the 580 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 is ambiguous\index{ambiguous interpretation}. 600 584 601 585 \begin{rationale} … … 611 595 The ``least polymorphic'' rule reduces the number of polymorphic function calls, since such 612 596 functions are presumably more expensive than monomorphic functions and since the more specific 613 function is presumably more appropriate. It also gives preference to monomorphic values (such as the614 \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 to616 interpretations that perform unsafe conversions, because those conversions potentially lose accuracy 617 or violate strong typing.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 functions 600 are preferred to interpretations that perform unsafe conversions, because those conversions 601 potentially lose accuracy or violate strong typing. 618 602 619 603 There are two notable differences between \CFA's overload resolution rules and the rules for … … 630 614 by \define{rewrite rules}. Each operator has a set of predefined functions that overload its 631 615 identifier. Overload resolution determines which member of the set is executed in a given 632 expression. The functions have \Index{internal linkage} and are implicitly declared with \Index{file633 scope}. The predefined functions and rewrite rules are discussed below for each of these 634 operators.616 expression. The functions have internal linkage\index{internal linkage} and are implicitly declared 617 with file scope\index{file scope}. The predefined functions and rewrite rules are discussed below 618 for each of these operators. 635 619 \begin{rationale} 636 620 Predefined functions and constants have internal linkage because that simplifies optimization in … … 645 629 of its subexpressions, this chapter can be taken as describing an overload resolution algorithm that 646 630 uses one bottom-up pass over an expression tree. Such an algorithm was first described (for Ada) by 647 Baker ~\cite{Bak:overload}. It is extended here to handle polymorphic functions and arithmetic648 conversions. The overload resolution rules and the predefined functions have been chosen so that, in649 programs that do not introduce overloaded declarations, expressions will have the same meaning in C 650 and in \CFA.631 Baker \cite{Bak:overload}. It is extended here to handle polymorphic functions and arithmetic 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 C and in \CFA. 651 635 \end{rationale} 652 636 … … 657 641 \end{rationale} 658 642 659 660 643 \subsection{Primary expressions} 661 662 644 \begin{syntax} 663 645 \lhs{primary-expression} … … 678 660 679 661 \semantics 680 The \Index{valid interpretation} of an \nonterm{identifier} are given by the visible\index{visible}681 declarations of the identifier.662 The valid interpretations\index{valid interpretations} of an \nonterm{identifier} are given by the 663 visible\index{visible} declarations of the identifier. 682 664 683 665 A \nonterm{constant} or \nonterm{string-literal} has one valid interpretation, which has the type … … 720 702 \end{rationale} 721 703 722 723 704 \subsubsection{Generic selection} 724 725 705 \constraints The best interpretation of the controlling expression shall be 726 706 unambiguous\index{ambiguous interpretation}, and shall have type compatible with at most one of the … … 762 742 \end{lstlisting} 763 743 764 765 744 \subsubsection{Array subscripting} 766 767 745 \begin{lstlisting} 768 746 forall( type T ) lvalue T ?[?]( T *, ptrdiff_t );@\use{ptrdiff_t}@ … … 816 794 817 795 Each combination of function designators and argument interpretations is considered. For those 818 interpretations of the \nonterm{postfix-expression} 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:796 interpretations of the \nonterm{postfix-expression} 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 explicit parameter: 822 800 \begin{itemize} 823 801 \item … … 827 805 \item 828 806 if the function designator's type does not include a prototype or if the argument corresponds to 829 ``\lstinline$...$'' in a prototype, a \Index{default argument promotion} is applied to it. 807 ``\lstinline$...$'' in a prototype, a default argument promotion\index{default argument promotions} 808 is applied to it. 830 809 \end{itemize} 831 810 The type of the valid interpretation is the return type of the function designator. 832 811 833 812 For those combinations where the interpretation of the \nonterm{postfix-expression} is a 834 \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 that813 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 parameters such that 837 816 \begin{itemize} 838 817 \item 839 If the declaration of the implicit parameter uses \Index{type-class} \lstinline$type$\use{type}, the840 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 argument842 must be a function type.818 If the declaration of the implicit parameter uses type-class\index{type-class} 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 it 821 uses \lstinline$ftype$, the implicit argument must be a function type. 843 822 844 823 \item 845 824 if an explicit parameter's type uses any implicit parameters, then the corresponding explicit 846 argument must have a type that is (or can be safely converted\index{safe conversion } to) the type825 argument must have a type that is (or can be safely converted\index{safe conversions} to) the type 847 826 produced by substituting the implicit arguments for the implicit parameters in the explicit 848 827 parameter type. … … 853 832 854 833 \item 855 for each \Index{assertion parameter} in the function designator's type, there must be an object or856 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.834 for each assertion parameter\index{assertion parameters} in the function designator's type, there 835 must be an object or function with the same identifier that is visible at the call site and whose 836 type is compatible with or can be specialized to the type of the assertion declaration. 858 837 \end{itemize} 859 838 There is a valid interpretation for each such set of implicit parameters. The type of each valid … … 869 848 Every set of valid interpretations that have mutually compatible\index{compatible type} result types 870 849 also produces an interpretation of the function call expression. The type of the interpretation is 871 the \Index{composite type} of the types of the valid interpretations, and the value of the872 interpretation is that of the \Index{best valid interpretation}.850 the composite\index{composite type} type of the types of the valid interpretations, and the value of 851 the interpretation is that of the best valid interpretation\index{best valid interpretations}. 873 852 \begin{rationale} 874 853 One desirable property of a polymorphic programming language is \define{generalizability}: the … … 879 858 880 859 \CFA\index{deficiencies!generalizability} does not fully possess this property, because 881 \Index{unsafe conversion} are not done when arguments are passed to polymorphic parameters. 882 Consider860 unsafe\index{unsafe conversions} conversions are not done when arguments are passed to polymorphic 861 parameters. Consider 883 862 \begin{lstlisting} 884 863 float g( float, float ); … … 981 960 r( 0 ); 982 961 \end{lstlisting} 983 The \lstinline$int 0$ could be passed to (8), or the \lstinline$(void *)$ \Index{specialization} of984 the null pointer\index{null pointer} \lstinline$0$\use{0} could be passed to (9). The former is 985 c hosen because the \lstinline$int$ \lstinline$0$ is \Index{less polymorphic}. For986 the same reason, \lstinline$int$ \lstinline$0$ is passed to \lstinline$r()$, even though it has 987 \emph{no} declared parameter types.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 could be passed to (9). The former is chosen because the \lstinline$int$ \lstinline$0$ is less 965 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. 988 967 989 968 … … 993 972 least one interpretation of \lstinline$s$ whose type is a structure type or union type containing a 994 973 member named \lstinline$m$. If two or more interpretations of \lstinline$s$ have members named 995 \lstinline$m$ with mutually compatible types, then the expression has an \Index{ambiguous996 interpretation } whose type is the composite type of the types of the members. If an interpretation997 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.974 \lstinline$m$ with mutually compatible types, then the expression has an ambiguous 975 interpretation\index{ambiguous interpretation} whose type is the composite type of the types of the 976 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. The expression has no other interpretations. 1000 979 1001 980 The expression ``\lstinline$p->m$'' has the same interpretations as the expression … … 1168 1147 \begin{lstlisting} 1169 1148 X ?++( volatile X * ), ?++( _Atomic volatile X * ), 1170 ?--( volatile X * ), ?--( _Atomic volatile X * );1149 ?--( volatile X * ), ?--( _Atomic volatile X * ); 1171 1150 \end{lstlisting} 1172 1151 For every complete enumerated type \lstinline$E$ there exist … … 1174 1153 \begin{lstlisting} 1175 1154 E ?++( volatile E * ), ?++( _Atomic volatile E * ), 1176 ?--( volatile E * ), ?--( _Atomic volatile E * );1155 ?--( volatile E * ), ?--( _Atomic volatile E * ); 1177 1156 \end{lstlisting} 1178 1157 … … 1195 1174 First, each interpretation of the operand of an increment or decrement expression is considered 1196 1175 separately. For each interpretation that is a bit-field or is declared with the 1197 \lstinline$register$\index{register@{\lstinline$register$}} \index{Itorage-class specifier}, the1198 expression has one valid interpretation, with the type of the operand, and the expression is 1199 ambiguous if the operand is.1176 \lstinline$register$\index{register@{\lstinline$register$}} storage-class 1177 specifier\index{storage-class specifier}, the expression has one valid interpretation, with the type 1178 of the operand, and the expression is ambiguous if the operand is. 1200 1179 1201 1180 For the remaining interpretations, the expression is rewritten, and the interpretations of the … … 1544 1523 \constraints 1545 1524 The operand of the unary ``\lstinline$&$'' operator shall have exactly one 1546 \Index{interpretation}\index{ambiguous interpretation}, which shall be unambiguous.1525 interpretation\index{ambiguous interpretation}\index{interpretations}, which shall be unambiguous. 1547 1526 1548 1527 \semantics … … 1617 1596 forall( ftype FT ) int !?( FT * ); 1618 1597 \end{lstlisting} 1619 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the1620 rank of \lstinline$int$ there exist1598 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 1599 rank}greater than the rank of \lstinline$int$ there exist 1621 1600 % Don't use predefined: keep this out of prelude.cf. 1622 1601 \begin{lstlisting} … … 1681 1660 1682 1661 1683 \subsubsection{The \lstinline$sizeof$ and \lstinline$_Alignof$operators}1662 \subsubsection{The {\tt sizeof} and {\tt \_Alignof} operators} 1684 1663 1685 1664 \constraints … … 1688 1667 1689 1668 When the \lstinline$sizeof$\use{sizeof} operator is applied to an expression, the expression shall 1690 have exactly one \Index{interpretation}\index{ambiguous interpretation}, which shall1669 have exactly one interpretation\index{ambiguous interpretation}\index{interpretations}, which shall 1691 1670 be unambiguous. \semantics A \lstinline$sizeof$ or \lstinline$_Alignof$ expression has one 1692 1671 interpretation, of type \lstinline$size_t$. … … 1718 1697 \end{rationale} 1719 1698 1720 1721 1699 \subsection{Cast operators} 1722 1723 1700 \begin{syntax} 1724 1701 \lhs{cast-expression} … … 1733 1710 \semantics 1734 1711 1735 In a \Index{cast expression} ``\lstinline$($\nonterm{type-name}\lstinline$)e$'', if1736 \nonterm{type-name} 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{type-name}, and the interpretation ofthe cast1739 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 one1741 interpretation can be converted at thelowest cost or if the selected interpretation is ambiguous.1712 In a cast expression\index{cast expression} ``\lstinline$($\nonterm{type-name}\lstinline$)e$'', if 1713 \nonterm{type-name} is the type of an interpretation of \lstinline$e$, then that interpretation is the 1714 only interpretation of the cast expression; otherwise, \lstinline$e$ shall have some interpretation that 1715 can be converted to \nonterm{type-name}, and the interpretation of the cast expression is the cast 1716 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 the 1718 lowest cost or if the selected interpretation is ambiguous. 1742 1719 1743 1720 \begin{rationale} … … 1746 1723 \end{rationale} 1747 1724 1748 1749 1725 \subsection{Multiplicative operators} 1750 1751 1726 \begin{syntax} 1752 1727 \lhs{multiplicative-expression} … … 1808 1783 ?/?( _Complex long double, _Complex long double ); 1809 1784 \end{lstlisting} 1810 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the1811 rank of \lstinline$int$ there exist1785 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 1786 rank}greater than the rank of \lstinline$int$ there exist 1812 1787 % Don't use predefined: keep this out of prelude.cf. 1813 1788 \begin{lstlisting} … … 1816 1791 1817 1792 \begin{rationale} 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. 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. 1821 1797 \end{rationale} 1822 1798 … … 1853 1829 1854 1830 \begin{rationale} 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 )$''. 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 )$''. 1860 1837 1861 1838 These ``missing'' operators limit polymorphism. Consider … … 2009 1986 * ?-?( _Atomic const restrict volatile T *, _Atomic const restrict volatile T * ); 2010 1987 \end{lstlisting} 2011 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the 2012 rank of \lstinline$int$ there exist 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 2013 1991 % Don't use predefined: keep this out of prelude.cf. 2014 1992 \begin{lstlisting} … … 2061 2039 ?>>?( long long unsigned int, int); 2062 2040 \end{lstlisting} 2063 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2064 rank of \lstinline$int$ there exist2041 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2042 rank}greater than the rank of \lstinline$int$ there exist 2065 2043 % Don't use predefined: keep this out of prelude.cf. 2066 2044 \begin{lstlisting} … … 2070 2048 \begin{rationale} 2071 2049 The bitwise shift operators break the usual pattern: they do not convert both operands to a common 2072 type. The right operand only undergoes \Index{integer promotion}.2050 type. The right operand only undergoes integer promotion\index{integer promotion}. 2073 2051 \end{rationale} 2074 2052 … … 2145 2123 ?>=?( _Atomic const restrict volatile DT *, _Atomic const restrict volatile DT * ); 2146 2124 \end{lstlisting} 2147 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2148 rank of \lstinline$int$ there exist2125 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2126 rank}greater than the rank of \lstinline$int$ there exist 2149 2127 % Don't use predefined: keep this out of prelude.cf. 2150 2128 \begin{lstlisting} … … 2248 2226 ?!=?( forall( ftype FT2) FT2*, forall( ftype FT3) FT3 * ); 2249 2227 \end{lstlisting} 2250 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2251 rank of \lstinline$int$ there exist2228 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2229 rank}greater than the rank of \lstinline$int$ there exist 2252 2230 % Don't use predefined: keep this out of prelude.cf. 2253 2231 \begin{lstlisting} … … 2259 2237 The polymorphic equality operations come in three styles: comparisons between pointers of compatible 2260 2238 types, between pointers to \lstinline$void$ and pointers to object types or incomplete types, and 2261 between the \Index{null pointer} constant and pointers to any type. In the last case, a special2262 constraint rule for null pointer constant operands has been replaced by a consequence of the \CFA 2263 type system.2239 between the null pointer constant\index{null pointer} and pointers to any type. In the last case, a 2240 special constraint rule for null pointer constant operands has been replaced by a consequence of the 2241 \CFA type system. 2264 2242 \end{rationale} 2265 2243 … … 2300 2278 long long unsigned int ?&?( long long unsigned int, long long unsigned int ); 2301 2279 \end{lstlisting} 2302 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2303 rank of \lstinline$int$ there exist2280 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2281 rank}greater than the rank of \lstinline$int$ there exist 2304 2282 % Don't use predefined: keep this out of prelude.cf. 2305 2283 \begin{lstlisting} … … 2333 2311 long long unsigned int ?^?( long long unsigned int, long long unsigned int ); 2334 2312 \end{lstlisting} 2335 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2336 rank of \lstinline$int$ there exist2313 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2314 rank}greater than the rank of \lstinline$int$ there exist 2337 2315 % Don't use predefined: keep this out of prelude.cf. 2338 2316 \begin{lstlisting} … … 2366 2344 long long unsigned int ?|?( long long unsigned int, long long unsigned int ); 2367 2345 \end{lstlisting} 2368 For every extended integer type \lstinline$X$ with \Index{integer conversion rank} greater than the2369 rank of \lstinline$int$ there exist2346 For every extended integer type \lstinline$X$ with integer conversion rank \index{integer conversion 2347 rank}greater than the rank of \lstinline$int$ there exist 2370 2348 % Don't use predefined: keep this out of prelude.cf. 2371 2349 \begin{lstlisting} … … 2524 2502 2525 2503 \begin{rationale} 2526 The object of the above is to apply the \Index{usual arithmetic conversion}s when the second and2527 third operands have arithmetic type, and to combine the qualifiers of the second and third operands 2528 if they are pointers.2504 The object of the above is to apply the usual arithmetic conversions\index{usual arithmetic 2505 conversions} when the second and third operands have arithmetic type, and to combine the 2506 qualifiers of the second and third operands if they are pointers. 2529 2507 \end{rationale} 2530 2508 … … 3194 3172 3195 3173 \constraints 3196 If an identifier has \Index{no linkage}, there shall be no more than one declaration of the3197 identifier ( in a declarator or type specifier ) with compatible types in the same scope and in the 3198 same name space, except that:3174 If an identifier has no linkage\index{no linkage}, there shall be no more than one declaration of 3175 the identifier ( in a declarator or type specifier ) with compatible types in the same scope and in 3176 the same name space, except that: 3199 3177 \begin{itemize} 3200 3178 \item … … 3298 3276 \semantics 3299 3277 The \nonterm{type-parameter-list}s and assertions of the \nonterm{forall-specifier}s declare type 3300 identifiers, function and object identifiers with \Index{no linkage}.3278 identifiers, function and object identifiers with no linkage\index{no linkage}. 3301 3279 3302 3280 If, in the declaration ``\lstinline$T D1$'', \lstinline$T$ contains \nonterm{forall-specifier}s and … … 3306 3284 \end{lstlisting} 3307 3285 then a type identifier declared by one of the \nonterm{forall-specifier}s is an \define{inferred 3308 parameter} of the function declarator if and only if it is not an inferred parameter of a function3286 parameter} of the function declarator if and only if it is not an inferred parameter of a function 3309 3287 declarator in \lstinline$D$, and it is used in the type of a parameter in the following 3310 3288 \nonterm{type-parameter-list} or it and an inferred parameter are used as arguments of a 3311 \Index{specification} in one of the \nonterm{forall-specifier}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.3289 specification\index{specification} in one of the \nonterm{forall-specifier}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. 3314 3292 \begin{rationale} 3315 3293 Since every inferred parameter is used by some parameter, inference can be understood as a single … … 3334 3312 3335 3313 If a function declarator is part of a function definition, its inferred parameters and assertion 3336 parameters have \Index{block scope}; otherwise, identifiers declared by assertions have a3314 parameters have block scope\index{block scope}; otherwise, identifiers declared by assertions have a 3337 3315 \define{declaration scope}, which terminates at the end of the \nonterm{declaration}. 3338 3316 … … 3348 3326 and $g$ in their order of occurance in the function types' \nonterm{parameter-type-list}s. Let $f'$ 3349 3327 be $f$ with every occurrence of $f_i$ replaced by $g_i$, for all $i$. Then $f$ and $g$ are 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.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 same identifier and compatible type, and vice versa. 3353 3331 3354 3332 \examples … … 3460 3438 \lstinline$lvalue$ may be used to qualify the return type of a function type. Let \lstinline$T$ be 3461 3439 an unqualified version of a type; then the result of calling a function with return type 3462 \lstinline$lvalue T$ is a \Index{modifiable lvalue} of type \lstinline$T$.3440 \lstinline$lvalue T$ is a modifiable lvalue\index{modifiable lvalue} of type \lstinline$T$. 3463 3441 \lstinline$const$\use{const} and \lstinline$volatile$\use{volatile} qualifiers may also be added to 3464 3442 indicate that the function result is a constant or volatile lvalue. … … 3468 3446 \end{rationale} 3469 3447 3470 An {lvalue}-qualified type may be used in a \Index{cast expression} if the operand is an lvalue; the3471 result of the expression is an lvalue.3448 An {lvalue}-qualified type may be used in a cast expression\index{cast expression} if the operand is 3449 an lvalue; the result of the expression is an lvalue. 3472 3450 3473 3451 \begin{rationale} … … 3512 3490 3513 3491 \item 3514 References to \Index{const-qualified} types can be used instead of value parameters. Given the3515 {\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 of3492 References to const-qualified\index{const-qualified} 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 of 3517 3495 \begin{lstlisting} 3518 3496 void fiddle( Thing ); … … 3547 3525 object being initialized. An expression used in an \nonterm{initializer-list} is treated as being 3548 3526 cast to the type of the aggregate member that it initializes. In either case the cast must have a 3549 single unambiguous \Index{interpretation}.3527 single unambiguous interpretation\index{interpretations}. 3550 3528 3551 3529 … … 3569 3547 \begin{rationale} 3570 3548 The declarations allowed in a specification are much the same as those allowed in a structure, 3571 except that bit fields are not allowed, and \Index{incomplete type}s and function types are allowed. 3549 except that bit fields are not allowed, and incomplete types\index{incomplete types} and function 3550 types are allowed. 3572 3551 \end{rationale} 3573 3552 … … 3584 3563 3585 3564 \subsubsection{Assertions} 3586 3587 3565 \begin{syntax} 3588 3566 \lhs{assertion-list} … … 3602 3580 each \nonterm{type-parameter} in that specification's \nonterm{spec-parameter-list}. If the 3603 3581 \nonterm{type-parameter} uses type-class \lstinline$type$\use{type}, the argument shall be the type 3604 name of an \Index{object type}; if it uses \lstinline$dtype$, the argument shall be the type name of3605 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}.3582 name of an object type\index{object types}; if it uses \lstinline$dtype$, the argument shall be the 3583 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}. 3607 3585 3608 3586 \semantics … … 3617 3595 combining the declarations produced by each assertion. If the collection contains two declarations 3618 3596 that declare the same identifier and have compatible types, they are combined into one declaration 3619 with the \Index{composite type} constructed from the two types.3597 with the composite type\index{composite type} constructed from the two types. 3620 3598 3621 3599 \examples … … 3652 3630 \end{lstlisting} 3653 3631 3654 3655 3632 \subsection{Type declarations} 3656 3657 3633 \begin{syntax} 3658 3634 \lhs{type-parameter-list} … … 3680 3656 3681 3657 \semantics 3682 A \nonterm{type-parameter} or a \nonterm{type-declarator} 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{type-parameter} has \Index{no linkage}. Identifiers declared 3686 with type-class \lstinline$type$\use{type} are \Index{object type}s; those declared with type-class 3687 \lstinline$dtype$\use{dtype} are \Index{incomplete type}s; and those declared with type-class 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{spec-declaration-list} or polymorphic function that contains 3690 the \nonterm{type-parameter}. 3691 3692 A \nonterm{type-declarator} 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{storage-class specifier} or 3700 with storage-class 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). 3658 A \nonterm{type-parameter} or a \nonterm{type-declarator} 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{type-parameter} has no linkage\index{no linkage}. Identifiers 3662 declared with type-class \lstinline$type$\use{type} are object types\index{object types}; those 3663 declared with type-class \lstinline$dtype$\use{dtype} are incomplete types\index{incomplete types}; 3664 and those declared with type-class \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{spec-declaration-list} or polymorphic function that contains the \nonterm{type-parameter}. 3667 3668 A \nonterm{type-declarator} 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 storage-class 3677 specifier\index{storage-class specifiers} or with storage-class 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). 3704 3682 \begin{rationale} 3705 3683 Incomplete type declarations allow compact mutually-recursive types. … … 3720 3698 \end{rationale} 3721 3699 3722 A type declaration without an initializer and with \Index{storage-class 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{constant-expression}; neither is a structure 3725 or union that has a member whose type is not a \nonterm{constant-expression}. Every other 3726 \Index{object type} is a \nonterm{constant-expression}. Objects with static storage duration shall 3727 be declared with a type that is a \nonterm{constant-expression}.3700 A type declaration without an initializer and with storage-class specifier \index{storage-class 3701 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{constant-expression}; 3703 neither is a structure or union that has a member whose type is not a \nonterm{constant-expression}. 3704 Every other object type\index{object types} is a \nonterm{constant-expression}. Objects with static 3705 storage duration shall be declared with a type that is a \nonterm{constant-expression}. 3728 3706 \begin{rationale} 3729 3707 Type declarations can declare identifiers with external linkage, whereas typedef declarations … … 3736 3714 \end{rationale} 3737 3715 3738 An \Index{incomplete type} which is not a qualified version\index{qualified type} of a type is a 3739 value of \Index{type-class} \lstinline$dtype$. An object type\index{object types} which is not a 3740 qualified version of a type is a value of type-classes \lstinline$type$ and \lstinline$dtype$. A 3741 \Index{function type} is a value of type-class \lstinline$ftype$. 3716 An incomplete type\index{incomplete types} which is not a qualified version\index{qualified type} of 3717 a type is a value of type-class\index{type-class} \lstinline$dtype$. An object type\index{object 3718 types} which is not a qualified version of a type is a value of type-classes \lstinline$type$ and 3719 \lstinline$dtype$. A function type\index{function types} is a value of type-class 3720 \lstinline$ftype$. 3742 3721 \begin{rationale} 3743 3722 Syntactically, a type value is a \nonterm{type-name}, which is a declaration for an object which … … 3773 3752 3774 3753 \begin{rationale} 3775 Since \Index{incomplete type}s are not type values, they can not be used as the initializer in a3776 type declaration, or as the type of a structure or union member. This prevents the declaration of 3777 types that contain each other.3754 Since incomplete types\index{incomplete types} are not type values, they can not be used as the 3755 initializer in a type declaration, or as the type of a structure or union member. This prevents the 3756 declaration of types that contain each other. 3778 3757 \begin{lstlisting} 3779 3758 type t1; … … 3921 3900 A declaration\index{type declaration} of a type identifier \lstinline$T$ with type-class 3922 3901 \lstinline$type$ implicitly declares a \define{default assignment} function 3923 \lstinline$T ?=?( T *, T )$\use{?=?}, with the same \Index{scope} and \Index{linkage} as the3924 identifier \lstinline$T$.3902 \lstinline$T ?=?( T *, T )$\use{?=?}, with the same scope\index{scopes} and linkage\index{linkage} as 3903 the identifier \lstinline$T$. 3925 3904 \begin{rationale} 3926 3905 Assignment is central to C's imperative programming style, and every existing C object type has … … 3933 3912 \end{rationale} 3934 3913 3935 A definition\index{type definition} of a type identifier \lstinline$T$ with \Index{implementation3936 type } \lstinline$I$ and type-class \lstinline$type$ implicitly defines a default assignment3937 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$. Their3941 values are determined as follows:3914 A definition\index{type definition} of a type identifier \lstinline$T$ with implementation 3915 type\index{implementation type} \lstinline$I$ and type-class \lstinline$type$ implicitly defines a 3916 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 identifier 3920 \lstinline$T$. Their values are determined as follows: 3942 3921 \begin{itemize} 3943 3922 \item … … 4035 4014 4036 4015 \section{Statements and blocks} 4037 4038 4016 Many statements contain expressions, which may have more than one interpretation. The following 4039 sections describe how the \CFA translator selects an interpretation. In all cases the result of the4040 selection shall be a single unambiguous \Index{interpretation}.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}. 4041 4019 4042 4020 … … 4054 4032 \end{lstlisting} 4055 4033 may have more than one interpretation, but it shall have only one interpretation with an integral 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. 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. 4058 4037 4059 4038 … … 4101 4080 \appendix 4102 4081 4103 4104 4082 \chapter{Examples} 4105 4106 4083 4107 4084 \section{C types} … … 4206 4183 \end{lstlisting} 4207 4184 4208 Specifications that define the dereference operator ( or subscript operator ) require two 4209 parameters, one for the pointer type and one for the pointed-at ( or element ) type. Different 4210 specifications are needed for each set of \Index{type qualifier}s, because qualifiers are not 4211 in cluded intypes. The assertion ``\lstinline$|ptr_to( Safe_pointer, int )$'' should be read as4185 Specifications that define the dereference operator ( or subscript operator ) require two parameters, 4186 one for the pointer type and one for the pointed-at ( 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 as 4212 4189 ``\lstinline$Safe_pointer$ acts like a pointer to \lstinline$int$''. 4213 4190 \begin{lstlisting}
Note:
See TracChangeset
for help on using the changeset viewer.