gnucobol-users
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] gdb support from gcc-cobol


From: David Essex
Subject: Re: [open-cobol-list] gdb support from gcc-cobol
Date: Mon Jun 2 05:11:10 2003

On 02/06/03, Keisuke Nishida wrote:

> ...
>       IDENTIFICATION DIVISION.
>       PROGRAM-ID. prog.
>       DATA DIVISION.
>       WORKING-STORAGE SECTION.
>       01 G.
>         02 X PIC X(2).
>         02 Y PIC X(2).
>       PROCEDURE DIVISION.
>         DISPLAY Y.
>
> will be converted into something like this:
>
>int prog ()
>{
>  ...
>  static unsigned char b_G[4];
>  static cob_field f_Y = {2, b_G + 2, &cob_alnum_attr};
>
>  cob_display (&f_Y);
>  ...
>}

Perhaps this may be naive, but shouldn't the above be converted into a
structure ?

struct elem_G
{
  unsigned char X[2];
  unsigned char Y[2];
};

static struct elem_G f_G;

Also, Pascal has types called records and strings (not null terminated C
type strings).

Since these types are similar to COBOL types, maybe it could be used as a
model. 

PS: 
Structures may have boundary aliment problems on certain architectures,
such as i386.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]