Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Array declaration compiler bug?

Thread view: 
Kenneth P. Turvey - 09 Apr 2006 03:57 GMT
I noticed today that a program I've written has different behavior when
one of the variables is declared as:

int outPixel[]

instead of

int[] outPixel

Shouldn't these exhibit exactly the same behavior all the time?

- --
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

XMPP  IM: kpturvey@jabber.org
Yahoo IM: kpturvey2
Patricia Shanahan - 09 Apr 2006 04:48 GMT
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
[quoted text clipped - 9 lines]
>
> Shouldn't these exhibit exactly the same behavior all the time?

It is very difficult to say from a code snippet. For example:

int outPixel[],y;

and

int[] outPixel,y;

are different. Can you produce a complete, self-contained example?

Patricia
Kenneth P. Turvey - 09 Apr 2006 06:20 GMT
> It is very difficult to say from a code snippet. For example:
>
[quoted text clipped - 5 lines]
>
> are different. Can you produce a complete, self-contained example?

Yes, I understand the difference of that above.  I'll see if I can get
something small to work over the next week and post something at that
time.  The complete statement was:

       int[] outPixel = new int[]{0, 0, 0};

and

       int outPixel[] = new int[]{0, 0, 0};

This was followed by a looping construct that works fine for the first
line, but seems to use a newly initialized array for each iteration when
the second declaration is used.

The scoping is all wrong.  

- --
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

XMPP  IM: kpturvey@jabber.org
Yahoo IM: kpturvey2
Mike Schilling - 09 Apr 2006 18:51 GMT
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
[quoted text clipped - 24 lines]
>
> The scoping is all wrong.

If that's really the only difference, you might try disassembling the
resulting code with javap -c and seeing if that gives you any clues.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.