Path: utzoo!utgpu!water!watmath!clyde!att!ihnp4!cbmvax!carolyn
From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Manx problem with large arrays
Keywords: Manx C array help
Message-ID: <4231@cbmvax.UUCP>
Date: 11 Jul 88 21:58:01 GMT
References: <1795@rtmvax.UUCP>
Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS)
Organization: Commodore Technology, West Chester, PA
Lines: 52

In article <1795@rtmvax.UUCP> scot@rtmvax.UUCP (Scot Harris ) writes:
>
>I was unable to help a friend on the local network with the following 
>problem.  I only have the Lattice 4.0 compiler and was able to do
>what the manx compiler apprently can not.  
>[...]
>THE PROBLEM:
>
>Guru visitations when I attempt to set up and use large arrays. Use of the
>+D option when compiling does not help.  Here is my sample code to
>illustrate the problem:
>
>
>/*  try.c  */
>
>main() { static char Map [100000L]; long int i;

I personally would just stop doing that, and instead:


#include "exec/types.h"
#include "libraries/dos.h"

main()
   {
   UBYTE *Map = 0L;

   if(!(Map = (UBYTE *)AllocMem(100000L,MEMF_PUBLIC|MEMF_CLEAR)))
      cleanexit("Not enough mem",RETURN_FAIL);

   /* Then just reference Map as an array, as before */
   

   if(Map) FreeMem(Map,100000L);

   cleanexit("",RETURN_OK);
   }

cleanexit(s,n)
UBYTE *s;
int n;
   {
   /* if you wish, print error if you have somewhere to print it */
   exit(n);
   }
-- 
==========================================================================
  Carolyn Scheppner -- CATS  Commodore Amiga Technical Support
  PHONE 215-431-9180   UUCP  ...{uunet,allegra,rutgers}!cbmvax!carolyn 

 Pad with zeros for a light, airy program.
==========================================================================