🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #575

Re: ArrayList get problem.

#575
From: JRobert
Date: Wed, 11 Aug 2004 16:44
36 lines
2121 bytes
Marc Rohloff [TeamB] wrote:
> 
>>public class m68kDisassembler
>>{
>>	private static OPCODE_NODE[] curOpcode;
>>	public m68kDisassembler()
>>	public static string disassemble(byte[] memptr, uint index, out uint 
> 
> 
> This isn't correct. You have defined curOpCode so that it is static
> but then you are initializing it once every time you create the class
> (ie in the constructor).
> Also disassemble is static so it can be called without an instance
> which means the curOpcode array might never have been initialised.
> 

You are right i had often Null pointer reference exceptions.

> You probably want to make the constructor static too ie change
> 
>>	public m68kDisassembler()
> 
> to
> public static m68kDisassembler() 
> 
> Lastly since you probably know the number of elements in the arraylist
> why don't you just use a normal array. This would produce faster code.
> 
Ok i'm using now a normal array, and all seem to work properls so i can 
go on. :-)

I appreciate your help!

Regards,
Robert
Technical Details
Message-ID: <411a3f23$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <411910a7$1@newsgroups.borland.com> <1g4pi3sjwhqr7.dlg@marcrohloff.40tude.net> <4119c4b5$1@newsgroups.borland.com> <1gipscpbtb2f$.dlg@marcrohloff.40tude.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,e82952e970601dc8
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 11 Aug 2004 17:44:11 +0100
From: JRobert <tsync@cronospec.de>
User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: Re: ArrayList get problem.
References: <411910a7$1@newsgroups.borland.com> <1g4pi3sjwhqr7.dlg@marcrohloff.40tude.net> <4119c4b5$1@newsgroups.borland.com> <1gipscpbtb2f$.dlg@marcrohloff.40tude.net>
In-Reply-To: <1gipscpbtb2f$.dlg@marcrohloff.40tude.net>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.135.111.170
Message-ID: <411a3f23$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1092239139 80.135.111.170 (11 Aug 2004 08:45:39 -0700)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail