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

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

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

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

If the value of func is SIG_DFL, default handlingfor that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.Otherwise, func shall point to a function to be called when that signal occurs. Aninvocation of such a function because of a signal, or (recursively) of any further functionscalled by that invocation (other than functions in the standard library), is called a signalhandler.3When a signal occurs and func points to a function, it is implementation-definedwhether the equivalent of signal(sig, SIG_DFL); is executed or theimplementation prevents some implementation-defined set of signals (at least includingsig) from occurring until the current signal handling has completed; in the case ofSIGILL, the implementation may alternatively define that no action is taken.

Then theequivalent of (*func)(sig); is executed. If and when the function returns, if thevalue of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-definedvalue corresponding to a computational exception, the behavior is undefined; otherwisethe program will resume execution at the point it was interrupted.4If the signal occurs as the result of calling the abort or raise function, the signalhandler shall not call the raise function.5If the signal occurs other than as the result of calling the abort or raise function, thebehavior is undefined if the signal handler refers to any object with static storage durationother than by assigning a value to an object declared as volatile sig_atomic_t, orthe signal handler calls any function in the standard library other than the abortfunction, the _Exit function, or the signal function with the first argument equal tothe signal number corresponding to the signal that caused the invocation of the handler.Furthermore, if such a call to the signal function results in a SIG_ERR return, thevalue of errno is indeterminate.220)6At program startup, the equivalent ofsignal(sig, SIG_IGN);220) If any signal is generated by an asynchronous signal handler, the behavior is undefined.§7.14.1.1Library247ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256may be executed for some signals selected in an implementation-defined manner; theequivalent ofsignal(sig, SIG_DFL);is executed for all other signals defined by the implementation.7The implementation shall behave as if no library function calls the signal function.Returns8If the request can be honored, the signal function returns the value of func for themost recent successful call to signal for the specified signal sig.

Otherwise, a value ofSIG_ERR is returned and a positive value is stored in errno.Forward references: the abort function (7.20.4.1), the exit function (7.20.4.3), the_Exit function (7.20.4.4).7.14.2 Send signal7.14.2.1 The raise functionSynopsis1#include <signal.h>int raise(int sig);Description2The raise function carries out the actions described in 7.14.1.1 for the signal sig. If asignal handler is called, the raise function shall not return until after the signal handlerdoes.Returns3The raise function returns zero if successful, nonzero if unsuccessful.248Library§7.14.2.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.15 Variable arguments <stdarg.h>1The header <stdarg.h> declares a type and defines four macros, for advancingthrough a list of arguments whose number and types are not known to the called functionwhen it is translated.2A function may be called with a variable number of arguments of varying types.

Asdescribed in 6.9.1, its parameter list contains one or more parameters. The rightmostparameter plays a special role in the access mechanism, and will be designated parmN inthis description.3The type declared isva_listwhich is an object type suitable for holding information needed by the macrosva_start, va_arg, va_end, and va_copy. If access to the varying arguments isdesired, the called function shall declare an object (generally referred to as ap in thissubclause) having type va_list. The object ap may be passed as an argument toanother function; if that function invokes the va_arg macro with parameter ap, thevalue of ap in the calling function is indeterminate and shall be passed to the va_endmacro prior to any further reference to ap.221)7.15.1 Variable argument list access macros1The va_start and va_arg macros described in this subclause shall be implementedas macros, not functions.

It is unspecified whether va_copy and va_end are macros oridentifiers declared with external linkage. If a macro definition is suppressed in order toaccess an actual function, or a program defines an external identifier with the same name,the behavior is undefined. Each invocation of the va_start and va_copy macrosshall be matched by a corresponding invocation of the va_end macro in the samefunction.7.15.1.1 The va_arg macroSynopsis1#include <stdarg.h>type va_arg(va_list ap, type);Description2The va_arg macro expands to an expression that has the specified type and the value ofthe next argument in the call.

The parameter ap shall have been initialized by theva_start or va_copy macro (without an intervening invocation of the va_end221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in whichcase the original function may make further use of the original list after the other function returns.§7.15.1.1Library249ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256macro for the same ap). Each invocation of the va_arg macro modifies ap so that thevalues of successive arguments are returned in turn. The parameter type shall be a typename specified such that the type of a pointer to an object that has the specified type canbe obtained simply by postfixing a * to type. If there is no actual next argument, or iftype is not compatible with the type of the actual next argument (as promoted accordingto the default argument promotions), the behavior is undefined, except for the followingcases:— one type is a signed integer type, the other type is the corresponding unsigned integertype, and the value is representable in both types;— one type is pointer to void and the other is a pointer to a character type.Returns3The first invocation of the va_arg macro after that of the va_start macro returns thevalue of the argument after that specified by parmN .

Successive invocations return thevalues of the remaining arguments in succession.7.15.1.2 The va_copy macroSynopsis1#include <stdarg.h>void va_copy(va_list dest, va_list src);Description2The va_copy macro initializes dest as a copy of src, as if the va_start macro hadbeen applied to dest followed by the same sequence of uses of the va_arg macro ashad previously been used to reach the present state of src.

Neither the va_copy norva_start macro shall be invoked to reinitialize dest without an interveninginvocation of the va_end macro for the same dest.Returns3The va_copy macro returns no value.7.15.1.3 The va_end macroSynopsis1#include <stdarg.h>void va_end(va_list ap);Description2The va_end macro facilitates a normal return from the function whose variableargument list was referred to by the expansion of the va_start macro, or the functioncontaining the expansion of the va_copy macro, that initialized the va_list ap. Theva_end macro may modify ap so that it is no longer usable (without being reinitialized250Library§7.15.1.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3by the va_start or va_copy macro).

If there is no corresponding invocation of theva_start or va_copy macro, or if the va_end macro is not invoked before thereturn, the behavior is undefined.Returns3The va_end macro returns no value.7.15.1.4 The va_start macroSynopsis1#include <stdarg.h>void va_start(va_list ap, parmN);Description2The va_start macro shall be invoked before any access to the unnamed arguments.3The va_start macro initializes ap for subsequent use by the va_arg and va_endmacros. Neither the va_start nor va_copy macro shall be invoked to reinitialize apwithout an intervening invocation of the va_end macro for the same ap.4The parameter parmN is the identifier of the rightmost parameter in the variableparameter list in the function definition (the one just before the , ...).

If the parameterparmN is declared with the register storage class, with a function or array type, orwith a type that is not compatible with the type that results after application of the defaultargument promotions, the behavior is undefined.Returns5The va_start macro returns no value.6EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but notmore than MAXARGS arguments), then passes the array as a single argument to function f2. The number ofpointers is specified by the first argument to f1.#include <stdarg.h>#define MAXARGS31void f1(int n_ptrs, ...){va_list ap;char *array[MAXARGS];int ptr_no = 0;§7.15.1.4Library251ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256if (n_ptrs > MAXARGS)n_ptrs = MAXARGS;va_start(ap, n_ptrs);while (ptr_no < n_ptrs)array[ptr_no++] = va_arg(ap, char *);va_end(ap);f2(n_ptrs, array);}Each call to f1 is required to have visible the definition of the function or a declaration such asvoid f1(int, ...);7EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after theindicated number of arguments; after f2 has been called once with the whole list, the trailing part of the listis gathered again and passed to function f4.#include <stdarg.h>#define MAXARGS 31void f3(int n_ptrs, int f4_after, ...){va_list ap, ap_save;char *array[MAXARGS];int ptr_no = 0;if (n_ptrs > MAXARGS)n_ptrs = MAXARGS;va_start(ap, f4_after);while (ptr_no < n_ptrs) {array[ptr_no++] = va_arg(ap, char *);if (ptr_no == f4_after)va_copy(ap_save, ap);}va_end(ap);f2(n_ptrs, array);// Now process the saved copy.n_ptrs -= f4_after;ptr_no = 0;while (ptr_no < n_ptrs)array[ptr_no++] = va_arg(ap_save, char *);va_end(ap_save);f4(n_ptrs, array);}252Library§7.15.1.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.16 Boolean type and values <stdbool.h>1The header <stdbool.h> defines four macros.2The macroboolexpands to _Bool.3The remaining three macros are suitable for use in #if preprocessing directives.

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

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

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

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