RE: Euphoria versus Java

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu