[an error occurred while processing this directive]
2 Fat Robot - ANSI (ISO/IEC), undefined behavior, integer overflow, u16 - по существу (+)
(«Телесистемы»: Конференция «Цифровые сигнальные процессоры (DSP) и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено SM 27 апреля 2005 г. 09:07

ISO/IEC JTC1/SC22/WG14 N843; August 3, 1998


3.18
[#1] undefined behavior
behavior, upon use of a nonportable or erroneous program
construct, of erroneous data, or of indeterminately valued
objects, for which this International Standard imposes no
requirements

[#2] NOTE Possible undefined behavior ranges from ignoring |
the situation completely with unpredictable results, to
behaving during translation or program execution in a
documented manner characteristic of the environment (with or
without the issuance of a diagnostic message), to
terminating a translation or execution (with the issuance of
a diagnostic message).

[#3] EXAMPLE An example of undefined behavior is the
behavior on integer overflow.

И свежая редакция:
ISO/IEC 9899:1999 (E)


3.4.3
1 undefined behavior
behavior, upon use of a nonportable or erroneous program construct or of erroneous
for which this International Standard imposes no requirements
2 NOTE Possible undefined behavior ranges from ignoring the situation completely with
results, to behaving during translation or program execution in a documented manner characteristic
environment (with or without the issuance of a diagnostic message), to terminating a
execution (with the issuance of a diagnostic message).
3 EXAMPLE An example of undefined behavior is the behavior on integer overflow.

Так что из этого параграфа совершенно явно следует, что использование целочисленного переполнения есть то самое "undefined behavior" и может привести к чему угодно вплоть до аварийного завершения компилятора или программы. Про АЛУ это я просто так к слову сказал, естесвенно в стандарте про него ничего нет, но приведенной мной цитаты вполне достаточно для прояснения ситуации в целом.

А про тип "u16" - как он определен в "большинстве компилеров" мне совершенно не интересно. Это одна вода. Речь про стандарт. В свою очередь, плиз ссылочку на параграф стандарта, где прописано что это за "u16" и каковы его параметры.

Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru