Downcasting
Fabrice Medio
fmedio@mandrakesoft.com
Mon Jun 25 14:56:00 GMT 2001
Hello !
One of my colleagues noticed that gcc didn't check for implicit
downcastings.
Look at this :
~/tmp$ cat Foobar.java
class Foobar { char func(int i) { return i; } }
Sun compilers obviously refuse to compile :
/tmp$ javac Foobar.java
Foobar.java:2: possible loss of precision
found : int
required: char
class Foobar { char func(int i) { return i; } }
^
1 error
On the contrary, gcj remains silent :
~/tmp$ gcj -C -Wall Foobar.java
~/tmp$
Is this a bug or a feature ?
Fabrice
--
Fabrice Medio <fmedio@mandrakesoft.com>
More information about the Java
mailing list