Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 6

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 6 страницаСтандарт языка Си С99 TC (1113411) страница 62019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 6)

Floating-point operations implicitly set the status flags; modes affect resultvalues of floating-point operations. Implementations that support such floating-point state arerequired to regard changes to it as side effects — see annex F for details. The floating-pointenvironment library <fenv.h> provides a programming facility for indicating when these sideeffects matter, freeing the implementations in other cases.§5.1.2.3Environment13ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256— At program termination, all data written into files shall be identical to the result thatexecution of the program according to the abstract semantics would have produced.— The input and output dynamics of interactive devices shall take place as specified in7.19.3.

The intent of these requirements is that unbuffered or line-buffered outputappear as soon as possible, to ensure that prompting messages actually appear prior toa program waiting for input.6What constitutes an interactive device is implementation-defined.7More stringent correspondences between abstract and actual semantics may be defined byeach implementation.8EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actualsemantics: at every sequence point, the values of the actual objects would agree with those specified by theabstract semantics.

The keyword volatile would then be redundant.9Alternatively, an implementation might perform various optimizations within each translation unit, suchthat the actual semantics would agree with the abstract semantics only when making function calls acrosstranslation unit boundaries. In such an implementation, at the time of each function entry and functionreturn where the calling function and the called function are in different translation units, the values of allexternally linked objects and of all objects accessible via pointers therein would agree with the abstractsemantics.

Furthermore, at the time of each such function entry the values of the parameters of the calledfunction and of all objects accessible via pointers therein would agree with the abstract semantics. In thistype of implementation, objects referred to by interrupt service routines activated by the signal functionwould require explicit specification of volatile storage, as well as other implementation-definedrestrictions.10EXAMPLE 2In executing the fragmentchar c1, c2;/* ... */c1 = c1 + c2;the ‘‘integer promotions’’ require that the abstract machine promote the value of each variable to int sizeand then add the two ints and truncate the sum. Provided the addition of two chars can be done withoutoverflow, or with overflow wrapping silently to produce the correct result, the actual execution need onlyproduce the same result, possibly omitting the promotions.11EXAMPLE 3Similarly, in the fragmentfloat f1, f2;double d;/* ...

*/f1 = f2 * d;the multiplication may be executed using single-precision arithmetic if the implementation can ascertainthat the result would be the same as if it were executed using double-precision arithmetic (for example, if dwere replaced by the constant 2.0, which has type double).14Environment§5.1.2.3WG14/N125612Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriatesemantics. Values are independent of whether they are represented in a register or in memory. Forexample, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and loadis required to round to the precision of the storage type. In particular, casts and assignments are required toperform their specified conversion.

For the fragmentdouble d1, d2;float f;d1 = f = expression;d2 = (float) expression;the values assigned to d1 and d2 are required to have been converted to float.13EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations inprecision as well as range. The implementation cannot generally apply the mathematical associative rulesfor addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence ofoverflow and underflow. Likewise, implementations cannot generally replace decimal constants in order torearrange expressions.

In the following fragment, rearrangements suggested by mathematical rules for realnumbers are often not valid (see F.8).double x, y, z;/* ... */x = (x * y) * z;z = (x - y) + y ;z = x + x * y;y = x / 5.0;14EXAMPLE 6////////not equivalent to xnot equivalent to znot equivalent to znot equivalent to y*= y * z;= x;= x * (1.0 + y);= x * 0.2;To illustrate the grouping behavior of expressions, in the following fragmentint a, b;/* ... */a = a + 32760 + b + 5;the expression statement behaves exactly the same asa = (((a + 32760) + b) + 5);due to the associativity and precedence of these operators.

Thus, the result of the sum (a + 32760) isnext added to b, and that result is then added to 5 which results in the value assigned to a. On a machine inwhich overflows produce an explicit trap and in which the range of values representable by an int is[−32768, +32767], the implementation cannot rewrite this expression asa = ((a + b) + 32765);since if the values for a and b were, respectively, −32754 and −15, the sum a + b would produce a trapwhile the original expression would not; nor can the expression be rewritten either asa = ((a + 32765) + b);ora = (a + (b + 32765));since the values for a and b might have been, respectively, 4 and −8 or −17 and 12.

However, on a machinein which overflow silently generates some value and where positive and negative overflows cancel, theabove expression statement can be rewritten by the implementation in any of the above ways because thesame result will occur.§5.1.2.3Environment15ISO/IEC 9899:TC315Committee Draft — Septermber 7, 2007WG14/N1256EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In thefollowing fragment#include <stdio.h>int sum;char *p;/* ...

*/sum = sum * 10 - '0' + (*p++ = getchar());the expression statement is grouped as if it were written assum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));but the actual increment of p can occur at any time between the previous sequence point and the nextsequence point (the ;), and the call to getchar can occur at any point prior to the need of its returnedvalue.Forward references: expressions (6.5), type qualifiers (6.7.3), statements (6.8), thesignal function (7.14), files (7.19.3).16Environment§5.1.2.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC35.2 Environmental considerations5.2.1 Character sets1Two sets of characters and their associated collating sequences shall be defined: the set inwhich source files are written (the source character set), and the set interpreted in theexecution environment (the execution character set).

Each set is further divided into abasic character set, whose contents are given by this subclause, and a set of zero or morelocale-specific members (which are not members of the basic character set) calledextended characters. The combined set is also called the extended character set. Thevalues of the members of the execution character set are implementation-defined.2In a character constant or string literal, members of the execution character set shall berepresented by corresponding members of the source character set or by escapesequences consisting of the backslash \ followed by one or more characters.

A byte withall bits set to 0, called the null character, shall exist in the basic execution character set; itis used to terminate a character string.3Both the basic source and basic execution character sets shall have the followingmembers: the 26 uppercase letters of the Latin alphabetANBOCPDQERFSGTHUIVJWKXLYMZkxlymz,{|.}the 26 lowercase letters of the Latin alphabetanbocpdqerfsgthuivjw3456789)]*^+_the 10 decimal digits012the following 29 graphic characters!;"<#=%>&?'[(\/~:the space character, and control characters representing horizontal tab, vertical tab, andform feed. The representation of each member of the source and execution basiccharacter sets shall fit in a byte. In both the source and execution basic character sets, thevalue of each character after 0 in the above list of decimal digits shall be one greater thanthe value of the previous.

In source files, there shall be some way of indicating the end ofeach line of text; this International Standard treats such an end-of-line indicator as if itwere a single new-line character. In the basic execution character set, there shall becontrol characters representing alert, backspace, carriage return, and new line. If anyother characters are encountered in a source file (except in an identifier, a characterconstant, a string literal, a header name, a comment, or a preprocessing token that is never§5.2.1Environment17ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256converted to a token), the behavior is undefined.4A letter is an uppercase letter or a lowercase letter as defined above; in this InternationalStandard the term does not include other characters that are letters in other alphabets.5The universal character name construct provides a way to name other characters.Forward references: universal character names (6.4.3), character constants (6.4.4.4),preprocessing directives (6.10), string literals (6.4.5), comments (6.4.9), string (7.1.1).5.2.1.1 Trigraph sequences1Before any other processing takes place, each occurrence of one of the followingsequences of three characters (called trigraph sequences12)) is replaced with thecorresponding single character.??=??(??/#[\??)??'??<]^{??!??>??-|}~No other trigraph sequences exist.

Each ? that does not begin one of the trigraphs listedabove is not changed.2EXAMPLE 1??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)becomes#define arraycheck(a, b) a[b] || b[a]3EXAMPLE 2The following source lineprintf("Eh???/n");becomes (after replacement of the trigraph sequence ??/)printf("Eh?\n");5.2.1.2 Multibyte characters1The source character set may contain multibyte characters, used to represent members ofthe extended character set. The execution character set may also contain multibytecharacters, which need not have the same encoding as for the source character set. Forboth character sets, the following shall hold:— The basic character set shall be present and each character shall be encoded as asingle byte.— The presence, meaning, and representation of any additional members is localespecific.12) The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set asdescribed in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.18Environment§5.2.1.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3— A multibyte character set may have a state-dependent encoding, wherein eachsequence of multibyte characters begins in an initial shift state and enters otherlocale-specific shift states when specific multibyte characters are encountered in thesequence.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6358
Авторов
на СтудИзбе
311
Средний доход
с одного платного файла
Обучение Подробнее