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

Re: gnubol: COBOL and C



Most but not all C functions return a thing which can be basically anything - an
int, char, struct, float. You need to know the type that is returned to generate
the code.

Prototypes are one way to provide this information. Another way could be to have
the caller make sure they have everything right.

Eg:
01  my-userid pic x(8).

move function getuserid () to my-userid.

So I assume that getuserid takes no parameters and returns an 8 byte character
array/string. This would mean that functions could not be used within expressions
though.

This would require a lot less infrastructure than prototypes but is more fragile.
With prototypes we could check argments and return values.

As for the DEC extension, I am only putting in mandatory extensions at the
moment, but substitute keywords are easy to do.

Tim Josling

Bernard Giroud wrote:

> The function extension is a really excellent idea, but do you need to declare
> the function as a prototype?
> The compiler will not check the parameters for  user subprograms anyway!
>
> Now for the declaration of the implementation, the COBOL VMS/Tru64 Unix is
> using the keyword "giving"
> instead of "returning".
>
> Bernard Giroud
>


--
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.