A
Andreas Leitgeb
Given a method:
void foo (int x, short y) { ... }
How would I call it with an immediate value for the second argument?
foo ( 42, (short)43);
Or did I miss some postfix-char for short literals (like "L" for long)?
(according to http://mindprod.com/jgloss/jcheat.html there isn't one)
Why is this cast necessary at all?
Why doesn't the /$(%$&/ compiler notice, that 43 is just fine and
provably without any loss of real information castable to a short?
Instead it tells me:
Test1.java:29: foo(int,short) in Test1 cannot be applied to (int,int)
foo( someIntVar, 43 );
PS: Yes, yes, changing foo to (int,int) would solve the problem, too,
but that's a different story.
PPS: don't take my swear-chars used with "compiler" too literally.
Surely, the compiler is "/$(%$&/" only because some /$(%$&/ speci-
fication demanded it to be so.
void foo (int x, short y) { ... }
How would I call it with an immediate value for the second argument?
foo ( 42, (short)43);
Or did I miss some postfix-char for short literals (like "L" for long)?
(according to http://mindprod.com/jgloss/jcheat.html there isn't one)
Why is this cast necessary at all?
Why doesn't the /$(%$&/ compiler notice, that 43 is just fine and
provably without any loss of real information castable to a short?
Instead it tells me:
Test1.java:29: foo(int,short) in Test1 cannot be applied to (int,int)
foo( someIntVar, 43 );
PS: Yes, yes, changing foo to (int,int) would solve the problem, too,
but that's a different story.
PPS: don't take my swear-chars used with "compiler" too literally.
Surely, the compiler is "/$(%$&/" only because some /$(%$&/ speci-
fication demanded it to be so.