I disagree; C is not remotely like assembly language, and the pre-processor is 
pathetic compared to any other macro facility that I have seen. The confusion 
between pointers and arrays and the zero-delimited strings are booby traps for 
the unwary.

As to C++, it provides classes that are not subject to all of the pitfalls of 
the underlying C, so I would regard it as a safer choice.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> on behalf of 
Charles Mills <charl...@mcn.org>
Sent: Friday, January 12, 2018 12:28 PM
To: IBM-MAIN@listserv.ua.edu
Subject: Re: curious: Popularity & use of C on z/OS.

Let me weigh in on these topics. I am a very experienced HLASM product 
developer who switched his primary language to C++ about ten years ago.

First, how many end-user customers are undertaking the development of totally 
new applications? If you are fixing, enhancing or extending an application 
written in COBOL (or PL/I or even assembler) decades ago then committing to any 
new language makes little sense. I don't think it is a strike against C that 
few are doing so.

Second, I certainly didn't think C was very hard to learn. There was exactly 
one concept that I had trouble wrapping my arms around: that an array was an 
address, and that foo[0] was not the same thing as foo. Once I got really 
comfortable with that, I was good. I knew Rexx, some BASIC, a little FORTRAN, a 
smattering of PL/I, and once knew an old Intel language called PL/M. With that 
background, most of C was pretty easy.

Third, I would not recommend learning C. (What!?) If you are going to bother, 
learn C++. C is just kind of assembly language with a different format and a 
huge and helpful library. C has little advantage over the structured HLASM 
macros. C++, used well, is truly a game-changer. I have a co-worker who says 
"anything you can do in C++ I can do in C" and he is of course right. (Equally, 
anything I can do in C++ could be done by coding absolute machine instructions 
in hex.) But C++ provides an organization, a way of thinking about problems, 
that is truly a game changer. (And remember, I am not some PC kiddie or airline 
magazine manager. I wrote a successful mainframe commercial product in 
assembler.)

Fourth, I would recommend learning C++ the way I did, although it was 
accidental and I suspect few will heed my advice. During a period of 
non-employment I decided to stretch my brain by learning C#. C++ has a major 
flaw in that it is 99% a superset of C. You can be writing 1989 C and tell your 
manager you are writing C++, and there is no real way to call you out on that. 
C# is essentially C++ without the C. You are forced to write true 
object-oriented code. Then when mainframe product development again presented 
itself, C# is of course not really available on Z and so I transferred my new 
C# good habits to C++. I am a better C++ programmer because of C#.

Fifth, a detail. I don't know why IBM has not provided library functions like 
ENQ, but no matter, it is trivial to write them oneself. Some of them, such as 
WTO/WTOR, IBM has provided. (And FWIW, my guess is that the reason they did not 
is that their motivation for providing C on Z was not to enable new 
development, but to allow vendors like PeopleSoft to port their products. They 
provided the library functions that were required for that goal, and ENQ was 
not one of them.)

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of John McKown
Sent: Friday, January 12, 2018 5:56 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: curious: Popularity & use of C on z/OS.

This is being prompted by the recent thread about getting the name of the 
running job in C. These are just some random questions.

First, is C becoming more popular on z/OS? What for? I.e. batch programs, UNIX 
commands, CICS transactions, Db2 applications, ... ?

Given that C, in other *IX systems, is a "system implementation" language, I 
find it interesting that IBM has not tried to make z/OS C have some of the same 
emphasis. Or maybe that is what Metal C is for. What I'm getting at is that 
there are no "system level" function interfaces, such as for ENQ/DEQ or 
"Name/Token" pairs. Would such interfaces be of any general use?

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

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