lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 16, 2019 at 3:13 AM Francisco Olarte <folarte@peoplecall.com> wrote:
Adam? ( due to sig vs source-email-address discrepancies I do not know
the proper way to start mails toyou )...

I answer to either name. My name is Adam, my handle is Coda, and I go by either of them both online or IRL.


On Wed, May 15, 2019 at 8:31 PM Coda Highland <chighland@gmail.com> wrote:
> On Wed, May 15, 2019 at 12:56 PM Francisco Olarte <folarte@peoplecall.com> wrote:
....
>> (INTMAX - 0 + INTMIN)." it seemed ( and still seems to me ) he was
>> trying to redefine not arithmetically.

I should have quoted not, or used ~, but it seems I made myself understood.

In the end, yeah. Threw me off for a while but it made sense in the end.
 
Yep. Thats why I normally try to find ways to leave this to compiler
implementers and avoid mixing logic and arithmetic behaviour, they
work hard at it and generally get things right. And I also act as if
"undefined behaviour" means "we will insert a chunk of code to brick
your hard disk" and not "we'll choose one of the two apparently normal
results" which some people use, saves a lot of trouble in the not so
long run, it doesn't usually bite, but when it does it does it hard.

Francisco Olarte.

In this case, it's not undefined behavior. The spec dictates that it must be implementation-defined behavior. You can't count on it being consistent across compilers and platforms, but each compiler is expected to pick a behavior and stick with it. It has to be consistent and sensible and not break anything too badly. (Throwing an error is actually considered not breaking anything too badly, because it means the code doesn't proceed with an unpredictable state.)

/s/ Adam