[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnubol: STODGY and GNUVEAU compile



I have used pointer arithmetic a lot in COBOL. You can step up an array
of unlimited size without running into problems when someone turns on
array bounds checking. 

Let's say you define an array like this

01 group1.
  02  item pic x occurs 1 to 1000000 depending item-count.

If you set item-count to a large number, some compilers generate a huge
amount of code (several instructions per 4K of array size - should be
able to guess which one now).

There are other ways to avoid this like:

set ptr1 to address of item(2).

The CB2K spec for pointers is not that disruptive to the rest of the
compiler actually, so I don't have a problem putting it in if it will
help cobol programmers to contribute. A lot of things are not possible
or reasonable without pointers. Eg unstring needs to pass a list of
addresses and lengths, with no particular limit on the size of the list.

Tim Josling

Christopher Clark wrote:
> ... I'm not even sure pointer arithmetic is useful in COBOL.



--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.