Bug 492 : preprocessor cannot handle L added to 'long' values
Last modified: 2007-02-25 14:14




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P5
Severity:
normal

 

Reporter:
fjen
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2007-01-20 15:12
the preprocessor has problems with longs written as 1000L or 1000l

it reports:
Syntax Error: ";" inserted to complete BlockStatement
Additional Comment #1 From fjen 2007-01-20 15:13
example:

long timestamp = 1144340899 * 1000L;
java.util.Date d = java.util.new Date(timestamp);
println( d );
Additional Comment #2 From fry 2007-01-20 17:47
that's bizarre, but here's your workaround:

long timestamp = 1144340899;
long thousand = 1000;
long both = timestamp * thousand;
Date d = new Date(both);
println( d );

two notes on your original code, you should make both of those values longs
to make sure that the multiply is processed 64 bit. and there's no need to
put java.util in front of Date (unless you're importing something else random).
Additional Comment #3 From fjen 2007-01-21 06:05
thanks, i use this now:

Date d = new Date((long)1144340899*(long)1000);
println( d );

> two notes on your original code, you should make both of those values longs
> to make sure that the multiply is processed 64 bit. and there's no need to
> put java.util in front of Date (unless you're importing something else random)

wow that produced a compiler error with direct link to the bugs-db, haven't seen that for a
long while! :-) no clue how the java.util slipped infront there .. can you import at random
points in the code? might be an interessting method to work with ...
Additional Comment #4 From fjen 2007-02-25 07:26
PdeEmitter.java (Line 637)

---------------------------------

case NUM_FLOAT:
case NUM_LONG:

---------------------------------

fixes long values in form 1000L or 1000l.

F
Additional Comment #5 From fry 2007-02-25 14:14
thanks, got it in there for 0125.