Re: 'code too large' error with 2D array

From: Anthony Borla (ajborla_at_bigpond.com)
Date: 10/31/03


Date: Fri, 31 Oct 2003 08:26:04 GMT

Mac,

"Mac" <lojurk@wp.pl> wrote in message
news:8a425078.0310302348.69edde89@posting.google.com...
>
> Hi!. I've got following problem. The matter concerns
> 2D array filled with ints. Size: no of rows: 2000, no.
> of columns: 20. I have to process it in whole piece at
> one runtime cycle of the program. But here comes my
> problem. On my pasting the whole array into the code
> of it, then compiling, I get following error:
>
> ' Error no. 5. Code too large'.
>
> Tried to change the type of the array to long but
> to no avail. Everything works fine up to:
>
> no. of rows: 400 and no. of columns: 20.
>
> What's going on?. Can I get around it somehow?.
>

You're choking the compiler with too much source code ;) !!!

>
> I think about puting the array into separate file or
> groups of files(text file?) but how to put
> it inside the program?. Maybe there is some other
> easier solution?.
>

Loading the array from a text file sounds perfectly fine to me, and is quite
straightforward:

* Allocate requisite array
* Open a file stream and commence the read stream / load array
   cycle
* Close file stream, and start array processing

Easy !!!

Why would you want to include the array data in the source code, anyway -
security reasons such as avoiding tampering of the data by outsiders ? If
so, a simple option is to place the text file in the '.jar' file you are
using to distribute your program. There were a couple of posts on this
[accessing resources in a '.jar' file] recently.

I hope this helps.

Anthony Borla



Relevant Pages

  • Re: functional programming
    ... But if you're going to tromp over the original array straightaway ... Second-guessing such optimizations and hard-coding them in your source code can make the code more difficult to reason about and deal with in general, because it can put all of the properties I listed at risk. ... Mutation can be encapsulated locally in a controlled way that doesn't lead to problems, for example -- however, 'every' above is not encapsulated in that way. ...
    (comp.lang.scheme)
  • Why is [reply] missing in CLF ?
    ... WIKI has it wrong. ... They are complicating Forth, ... into a spcific user ARRAY .... ... Now source code has only important stuff. ...
    (comp.lang.forth)
  • Re: Learn to Program, by Chris Pine
    ... Maybe you should include the full source code. ... The error message says that the right side of an addition is nil. ... What I also think is strange is that "world" seems to be a two dimensional array when you first mention it, but later on you pass it to continent size along with two parameters. ... Even though you wouldn't need the braces as it all of the conditionals need to be true for the whole expression to become true. ...
    (comp.lang.ruby)
  • Response.WriteFile() giving an extra byte at the end?
    ... This is for an aspx page with Visual Basic as the code-behind page. ... I have tried various permutations of Content-Type ... I have also tried opening a file stream and copying the data ... to an array of bytes and then ...
    (microsoft.public.dotnet.framework.aspnet)
  • Response.WriteFile seems to be adding an extra byte
    ... I have tried various permutations of Content-Type ... I have also tried opening a file stream and copying the data ... to an array of bytes and then ... Windows 2000 Server, Visual Studio 2003 ...
    (microsoft.public.dotnet.languages.vb)