Article View: pl.comp.lang.c
Article #310366Re: przekręcenie licznika w zmiennej typu int - czy to UB ?
From: Mateusz Viste
Date: Tue, 07 Dec 2021 20:31
Date: Tue, 07 Dec 2021 20:31
18 lines
1468 bytes
1468 bytes
2021-12-07 o 11:24 -0800, Maciek napisał: > Jeśli przez pomnożenie zmiennej wychodzi wartość która przekraczająca > maksymalną wartość danego typu, to jest to już UB ? Poniżej zamieszczam kilka wycinków z ISO/IEC 9899 1990. 3.17.2: "An example of undefined behavior is the behavior on integer overflow" 6.3.6: "As with any other arithmetic overflow, if the result does not fit in the space provided the behavior is undefined" Annex G.2 (Undefined behavior): "An arithmetic operation (...) produces a result that cannot be represented in the space provided (such as overflow or underflow)" Mateusz
Technical Details
Message-ID:
<soogbe$6te$1@gioia.aioe.org>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!a/T4ApFfDwfCJeUuLpbuYw.user.46.165.242.75.POSTED!not-for-mailReferences:
<9fefc125-650e-496d-a385-87234f47a197n@googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!a/T4ApFfDwfCJeUuLpbuYw.user.46.165.242.75.POSTED!not-for-mail From: Mateusz Viste <mateusz@xyz.invalid> Newsgroups: pl.comp.lang.c Subject: Re: przekręcenie licznika w zmiennej typu int - czy to UB ? Date: Tue, 7 Dec 2021 21:31:42 +0100 Organization: . . . Message-ID: <soogbe$6te$1@gioia.aioe.org> References: <9fefc125-650e-496d-a385-87234f47a197n@googlegroups.com> Mime-Version: 1.0 Injection-Info: gioia.aioe.org; logging-data="7086"; posting-host="a/T4ApFfDwfCJeUuLpbuYw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; X-Notice: Filtered by postfilter v. 0.9.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit