This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
java/10253: String concatenation with int zero, as in ""+0, results in the empty string.
- From: lars at rimfaxe dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 28 Mar 2003 08:56:50 -0000
- Subject: java/10253: String concatenation with int zero, as in ""+0, results in the empty string.
- Reply-to: lars at rimfaxe dot com
>Number: 10253
>Category: java
>Synopsis: String concatenation with int zero, as in ""+0, results in the empty string.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Mar 28 09:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Lars Andersen
>Release: gcc version 3.3 20030324 (prerelease)
>Organization:
>Environment:
Redhat Linux 8.0.96 x86, Athlon XP
>Description:
Concatenation of String and int 0 is wrong.
Consider this program :
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public class Test
{
? public static void main(String[] args)
? {
??? System.out.println("Test");
??? System.out.println(""+0);
??? System.out.println(""+1);
? }
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I would expect the output to be :
Test
0
1
, but this is what i get :
Test
1
>How-To-Repeat:
Compile Test.java
> gcj --main=Test Test.java -o test
Run test
> ./test
It outputs :
Test
1
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: