[comp.sys.atari.st] big arrays in MW C

trb@stag.UUCP ( Todd Burkey ) (12/26/87)

Hi,
  Does anyone know if MWC will safely handle large arrays now? I know
that I had problems in the early versions with HDSCAN's arrays in that
I had to keep the total amount of data in a particular array less than
32K bytes. Now when I compile tests (i.e. a char[10000][12]), I get a
message like:
  strict: size of array overflows size_t
which doesn't make sense, since size_t is a long if I remember correctly.
Somewhat confusing (and frustrating now that my manual is out of phase with
the newer version of the compiler that I got recently.)

What I really want to do is fold my Unix version of HDSCAN back into the
ST version, and preferably with MW C. If it looks like it will be too much
of a mess, I will probably wait for the new version of Megamax, since that
sounds somewhat promising as well.  (Yes, the Unix version is done...I
am mailing the source code to comp.sources.misc next week. Supports both
BSD and SYSV flavors of Unix).

  -Thanks,
   Todd Burkey
   trb@stag.UUCP

dag@chinet.UUCP (Daniel A. Glasser) (12/29/87)

In article <291@stag.UUCP> trb@stag.UUCP ( Todd Burkey ) writes:
>Hi,
>  Does anyone know if MWC will safely handle large arrays now? I know
>that I had problems in the early versions with HDSCAN's arrays in that
>I had to keep the total amount of data in a particular array less than
>32K bytes. Now when I compile tests (i.e. a char[10000][12]), I get a
>message like:
>  strict: size of array overflows size_t
>
This message is just a warning -- it is because size_t is in fact an
unsigned int in MWC 2.1.7.  size_t is the default type of the result
of the sizeof operator.  MWC does support objects larger than 64K now,
and this warning is harmless unless you are passing sizeof(foo) to a
function that is expecting an int.  Sizeof is promoted to a long when
it overflows the unsigned int.  When MWC releases an ANSI conforming
(rather than K&R, which is what it conforms to now with some ANSI
extensions), size_t will become a long instead of an int, and then
this kind of warning will go away.

Even in version 2.0, external objects of > 32K were supported, they
just could not be declared.  They could be allocated with lmalloc()
and then accessed as arrays using the pointer/array equivilance.

I hope all of this helps.
-- 
					Daniel A. Glasser
					...!ihnp4!chinet!dag
					...!ihnp4!mwc!dag
					...!ihnp4!mwc!gorgon!dag
	One of those things that goes "BUMP!!! (ouch!)" in the night.