One addition to make it more clear (hopefully):

normally pointers to structures are passed between PL/1 and C,
and these structures are defined (language independent) using a
repository, from which both structure definitions for both languages
are generated (and for ASSEMBLER, too, BTW).

The char fields inside these structures are - of course - not null terminated,
but they are fixed length CHAR fields, like in PL/1, or PL/1 VARCHARs,
consisting of a short length field (BIN FIXED(15) in PL/1) and a CHAR field
in maximum size.

The C routines then have to cope with this.

It may have to do with the history; we are an "old" ASSEMBLER shop,
where PL/1 was added as second language ca. 1980, and C as third language
in 1992 ca. - and this was done IMO in a very clean and straightforward manner -
I was not in charge at that time - too young.

Kind regards

Bernd



Am 29.06.2013 12:07, schrieb Bernd Oppolzer:
We do insurance math development in C since 1993, and the normal callers are PL/1
(on the mainframe platform, there are other platforms, too).

We decided that the main goal is that PL/1 callers feel comfortable, so we never request them to put hex zeroes at the end of the strings that we get, and we never put hex zeroes at the end of the strings that we return (blanks instead, if the strings have fixed length). If the lengths are variable, we pass explicit lengths; if the string to be returned has variable length,
we get a max length on entry and return the actual used length.

We expect and return double float values, which are rounded as exactly as possible (in double float format), but the conversion from and to decimal has to be done by PL/1.

This approach works well for C callers, too - in our experience.

What happens inside our package is of no concern to the callers. There are of course null-terminated strings and functions beginning with str... in some places, although I prefer
the mem... functions.

Kind regards

Bernd



Am 29.06.2013 04:30, schrieb zMan:
Require both? That irritates BOTH groups, and seems to have the weaknesses
of both. I must be missing what you're saying...


On Fri, Jun 28, 2013 at 9:40 PM, David Crayford <dcrayf...@gmail.com> wrote:

Why not do both? Use lengths and make sure the string is null terminated. That's how std::string works in C++ where you can call c_str() to return a
null terminated string.





----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



--
Bernd Oppolzer
---------------------------------------------------------------
*Oppolzer-Informatik
* Dipl. Inf. Bernd Oppolzer
Bärenhofstraße 23
70771 Leinfelden-Echterdingen
---------------------------------------------------------------
Tel.: +49 711 2272522
priv.: +49 711 7949590
eMail: bernd.oppol...@t-online.de <mailto:bernd.oppol...@t-online.de>
---------------------------------------------------------------
Für Umsatzsteuerzwecke:
SteuerNr.: 97 076 / 29921
USt-ID-Nr.: DE 147 700 393
---------------------------------------------------------------
Jubiläumsjahr 2013:
30 Jahre Oppolzer-Informatik


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to