Oppolzer - Informatik / Blog


Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

IBM-MAIN - C-Features in PL/1 - Vor- und Nachteile

Subject:

Re: Compile COBOL Programs In 64 Bit.

From:

Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>

Reply-To:

IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>

Date:

2015.01.21 15:01:00


Am 21.01.2015 um 14:28 schrieb P.G.:
> On Wed, 21 Jan 2015 08:38:38 +0100, Bernd Oppolzer wrote:
>>
>> It was the decision of the PL/1 language designers to make
>> the language more user friendly to the C community. You don't have to
>> use such language elements, if you don't like it. I see it this way:
>> PL/1 is such a powerful language, that it even allows different
>> programming styles. Or: why not allow language constructs, as long
>> as it is clear to the programmer, what the new language element does
>> and as long as the spirit of the language is not broken?
>>
> Are you saying that as an accommodation to C programmers PL/I
> has recently provided pointers with types, with increments by element
> size?

No, I don't think so.

I'm not aware of all the extensions to the PL/1 language of the last
years; there are some which I don't use like DEFINEd STRUCTURES,
ORDINAL TYPEs etc. ... mainly because the compatibility to the (long)
existing features is not so good, IMHO. But pointers that increment in
an other way than per address ... I don't think that that exists.

No, the things I had in mind was the assignments including increment
etc, the things like A += expression; etc ... works with other kinds
of operators, too, of cours, not only addition. And that you can add
an offset to a pointer simply by using the + sign. And, if C
programmers want to use functions like memset or memcpy, they can,
although there are other (PL/1) names for those functions (PLIMOVE
etc.).

>
>> BTW: variable ++; is not still possible in PL/1 for several good reasons.
>>
> I'm naive.  What's a good reason (other than economy of language design)
> for not providing "variable ++"?  (And what of "++ variable"?)  One
> possibility might be lexical ambiguity.

Some speculation on my part:

in C, everything is an expression; a ++ and ++ a are two very
different expressions, and this idea does not fit well into the PL/1
spirit.

The assignment a += 5; in C is an expression, too (and may be assigned
to other variables and used, whereever expressions are allowed in C).

But it is no problem to take this kind of syntax over to PL/1, WITHOUT
assigning a value to the assignment A += 5; (that is: without
violating the language).

In PL/1:

A = B = C;

has a total different meaning than

a = b = c;

in C.

This has to do with:

In C, assignment and comparison are two different operators, = and ==,
but in PL/1, the same operator = is used for both.

Kind regards

Bernd


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

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie