|
|
Subscribe / Log in / New account

Integer overflow

Integer overflow

Posted Apr 18, 2013 10:29 UTC (Thu) by epa (subscriber, #39769)
In reply to: Integer overflow by ibukanov
Parent article: A taste of Rust

The restricted integers supported by Ada are so simple and obvious that it's amazing so few other languages have adopted them.


to post comments

Integer overflow

Posted Apr 18, 2013 10:46 UTC (Thu) by ibukanov (subscriber, #3942) [Link]

Right, I forgot that Ada allowed since its introduction to declare integers of arbitrary range and the compiler adds runtime checks to throw an exception on out-of-range operations. Do modern Ada compilers optimize those range checks using the CPU's overflow control flags when the range is a full machine word?

Integer overflow

Posted Apr 30, 2013 6:20 UTC (Tue) by FranTaylor (guest, #80190) [Link]

You can do the same thing in any language that supports operator overloading. Write your own setters and you can restrict any type in any way you want.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds