[ Pobierz całość w formacie PDF ]
. 173long double is new.The first edition made long float equivalent to double; the locution hasbeen withdrawn.Enumerations are unique types that have integral values; associated with each enumeration isa set of named constants (Par.A.8.4).Enumerations behave like integers, but it is common fora compiler to issue a warning when an object of a particular enumeration is assignedsomething other than one of its constants, or an expression of its type.Because objects of these types can be interpreted as numbers, they will be referred to asarithmetic types.Types char, and int of all sizes, each with or without sign, and alsofloat doubleenumeration types, will collectively be called integral types.The types , , andlong double will be called floating types.The void type specifies an empty set of values.It is used as the type returned by functionsthat generate no value.A.4.3 Derived typesBeside the basic types, there is a conceptually infinite class of derived types constructed fromthe fundamental types in the following ways:arrays of objects of a given type;functions returning objects of a given type;pointers to objects of a given type;structures containing a sequence of objects of various types;unions capable of containing any of one of several objects of various types.In general these methods of constructing objects can be applied recursively.A.4.4 Type QualifiersAn object's type may have additional qualifiers.Declaring an object const announces that itsvalue will not be changed; declaring it volatile announces that it has special propertiesrelevant to optimization.Neither qualifier affects the range of values or arithmetic propertiesof the object.Qualifiers are discussed in Par.A.8.2.A.5 Objects and LvaluesAn Object is a named region of storage; an lvalue is an expression referring to an object.Anobvious example of an lvalue expression is an identifier with suitable type and storage class.There are operators that yield lvalues, if E is an expression of pointer type, then *E is an lvalueexpression referring to the object to which E points.The name ``lvalue'' comes from theE1 = E2 E1assignment expression in which the left operand must be an lvalue expression.The discussion of each operator specifies whether it expects lvalue operands and whether ityields an lvalue.A.6 ConversionsSome operators may, depending on their operands, cause conversion of the value of anoperand from one type to another.This section explains the result to be expected from such 174conversions.Par.6.5 summarizes the conversions demanded by most ordinary operators; itwill be supplemented as required by the discussion of each operator.A.6.1 Integral PromotionA character, a short integer, or an integer bit-field, all either signed or not, or an object ofenumeration type, may be used in an expression wherever an integer may be used.If an intintcan represent all the values of the original type, then the value is converted to ; otherwisethe value is converted to unsigned int.This process is called integral promotion.A.6.2 Integral ConversionsAny integer is converted to a given unsigned type by finding the smallest non-negative valuethat is congruent to that integer, modulo one more than the largest value that can berepresented in the unsigned type.In a two's complement representation, this is equivalent toleft-truncation if the bit pattern of the unsigned type is narrower, and to zero-filling unsignedvalues and sign-extending signed values if the unsigned type is wider.When any integer is converted to a signed type, the value is unchanged if it can be representedin the new type and is implementation-defined otherwise.A.6.3 Integer and FloatingWhen a value of floating type is converted to integral type, the fractional part is discarded; ifthe resulting value cannot be represented in the integral type, the behavior is undefined.Inparticular, the result of converting negative floating values to unsigned integral types is notspecified.When a value of integral type is converted to floating, and the value is in the representablerange but is not exactly representable, then the result may be either the next higher or nextlower representable value.If the result is out of range, the behavior is undefined.A.6.4 Floating TypesWhen a less precise floating value is converted to an equally or more precise floating type, thevalue is unchanged.When a more precise floating value is converted to a less precise floatingtype, and the value is within representable range, the result may be either the next higher orthe next lower representable value.If the result is out of range, the behavior is undefined.A.6.5 Arithmetic ConversionsMany operators cause conversions and yield result types in a similar way.The effect is tobring operands into a common type, which is also the type of the result.This pattern is calledthe usual arithmetic conversions." First, if either operand is long double, the other is converted to long double." Otherwise, if either operand is double, the other is converted to double." Otherwise, if either operand is float, the other is converted to float." Otherwise, the integral promotions are performed on both operands; then, if eitheroperand is unsigned long int, the other is converted to unsigned long int. 175" Otherwise, if one operand is long int and the other is unsigned int, the effectdepends on whether a long int can represent all values of an unsigned int; if so,the unsigned int operand is converted to long int; if not, both are converted tounsigned long int." Otherwise, if one operand is long int, the other is converted to long int." Otherwise, if either operand is unsigned int, the other is converted to unsignedint." intOtherwise, both operands have type.There are two changes here.First, arithmetic on float operands may be done in single precision,rather than double; the first edition specified that all floating arithmetic was double precision
[ Pobierz całość w formacie PDF ]
Tematy
Indexinformatyka programowanie uslug wcf wydanie iii juval l wy ebook
Wheeler Secure Programming for Linux and UNIX HOWTO (2003)
Addison Wesley Programming for the Java Virtual Machine (1999)
Visual Studio 2005 Programowanie z Windows API w jezyku C
Wprowadzenie do programowania Neurolingwistycznego J O'Connor, J Seymour
Linux Programmer s Guide PL P.Niewiadomski
java programming unleashed [ EN ], Java2
Chuck Barrett [Jake Pendleton Breach of Power (epub)
Aronson Elliot Psychologia Społeczna. Serce i Umysł (3)
Linux podrecznik administratora O. Kirch, T. Dawson