lotus



previous page: 1.17) Source code! I want source code! Where can I find some? (Mac Programming)
  
page up: Mac Programming FAQ
  
next page: 2.1) What is a handle? (Memory - Mac Programming)

1.18) I'm trying to use a largish array in Think C, but get a "code overflow" error. This is valid C, why doesn't it work? (Mac Programming)




Description

This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.

1.18) I'm trying to use a largish array in Think C, but get a "code overflow" error. This is valid C, why doesn't it work? (Mac Programming)

The ANSI standard does not guarantee that any structure larger than
32767 bytes be correctly handled. Because of historical constraints,
the Mac memory model is built around several small blocks of size 32K or
less; these are used both for code and global/static data. If you want
to use more code or data, you have to turn on "far code" or "far data" -
you still will not get around the restriction of 32K code or data per
compiled file, though.

This is one area where CodeWarrior's 68k support shines; it works around
most such limitations and it doesn't cost much in performance either!

As opposed to, say, DOS or Windows, however, you can allocate as much
memory as you want (and there is in the machine) and step through it
using ordinary pointers; it's just that global and static data space is
addressed off the A5 register using a 16bit displacement addressing mode
in the 68000 processor.

On the PowerPC, everything is 32bit from the start; that runtime model
is much more like UNIX. The horizon is the limit.

 

Continue to:















TOP
previous page: 1.17) Source code! I want source code! Where can I find some? (Mac Programming)
  
page up: Mac Programming FAQ
  
next page: 2.1) What is a handle? (Memory - Mac Programming)