RE: Euphoria versus Java
- Posted by Robert Craig <rds at RapidEuphoria.com> Apr 07, 2003
- 389 views
rforno at tutopia.com wrote: > I'm using a bit of Java now, and I noticed > the following: while Java routinely performs > a subscript checking (unlike C/C++), it does > not verify if byte, short, integer or long variables > overflow. So, if you have: > byte x = 127; > x = x + 1; > you end up with x = -128 instead of getting an > overflow error. Please correct me if there is a > way of checking for this kind of error > (someone in the list may know more Java than I do ;)). > I think this is another point in favor of Euphoria > that can be stressed. I don't know Java that well, but I don't think there is any way to "turn on" integer overflow detection, or catch it as an exception. If integer values become greater than what the programmer anticipated, the program will quietly fail. In Euphoria, integer values overflow automatically into floating-point values. The Translator works hard to eliminate checks for integer overflow. When it proves to itself that overflow can't occur, it generates smaller/faster C code. It can usually eliminate most of the checks this way. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com