comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Rubin <no.email@nospam.invalid>
Subject: Re: Should exceeding the range of Integer wrap around a la C?
Date: Mon, 21 May 2018 12:11:43 -0700
Date: 2018-05-21T12:11:43-07:00	[thread overview]
Message-ID: <87vabgn7rk.fsf@nightsong.com> (raw)
In-Reply-To: 7ba47ec1-28e7-43e1-83a0-2a4d2cf0fd92@googlegroups.com

> Should exceeding the range of Integer wrap around a la C?

It should raise a constraint error unless you turn off the check.  I
don't know if there is a specified result mandated if you have an
overflow with the check turned off.

In C, unsigned integer overflow is undefined behaviour, like a subscript
overflow.  Wraparound is one common result because of how machine
arithmetic works, but it is not guaranteed.  The program could instead
crash, or delete your files, or anything else.  See here:

http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html


  parent reply	other threads:[~2018-05-21 19:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 15:23 Should exceeding the range of Integer wrap around a la C? nrs5134
2018-05-21 15:27 ` Jacob Sparre Andersen
2018-05-21 15:45 ` Anh Vo
2018-05-21 16:46   ` Simon Wright
2018-05-21 18:47     ` Anh Vo
2018-05-21 15:57 ` Lucretia
2018-05-21 16:49   ` Simon Wright
2018-05-21 19:11 ` Paul Rubin [this message]
2018-05-22  0:39   ` Jere
2018-05-22  0:58     ` Dan'l Miller
2018-05-22  1:36     ` Paul Rubin
2018-05-21 20:43 ` nrs5134
2018-05-22 17:52   ` Björn Lundin
2018-05-22 20:11     ` nrs5134
2018-05-22 20:23       ` Björn Lundin
2018-05-23  7:35       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox