3 ms·
"Issues"? Not really: As in Kernighan and Ritchie, C has "idiosyncratic syntax". To me the full generality of the type statement is unreadable; the book even
by graycat 8y ago
"Issues"? Not really: As in Kernighan and Ritchie, C has "idiosyncratic syntax". To me the full generality of the type statement is unreadable; the book even has some code to show how to parse it. Also there is the notorious
i = ++j+++++k++
which is legal but on two compilers I tried it on got different answers.
To me idiosyncratic syntax is not a proof of worth or a trial by fire for admittance to the inner sanctum but just something more difficult to teach, learn, read, write, and debug than necessary.
C was designed at Bell AFTER IBM had PL/I running, and PL/I makes C look like kindergarten drool: Right off PL/I beats C in
(1) Scope of Names. What C has is a toy;
what PL/I has is powerful.
(2) Arrays. C doesn't really have any and asked the programmer to write pointer arithmetic using the usual array addressing arithmetic. PL/I has real arrays, and the compiler can pull constant expressions out of loops, optimize register usage, and otherwise have freedom to do things that the programmer can't see so that don't have to provide guarantees to the programmer.
(3) Strings. C doesn't really have any; the idea of ending a string with a null is the cause of too many buffer overflows. Each operation on a string is an external subroutine call, that is, resolved by the linkage editor. The PL/I people noticed that Fortran programmers did that, had a string package with a subroutine call for each little string operation, and some of the early IBM implementations of stings in PL/I did something similar, but by F level version 4 IBM saw that really compiling strings was MUCH faster. Basically PL/I and Fortran can be faster than C in array handling, and PL/I is faster than both C and Fortran in string handling.
(4) Structures. PL/I structures are just brilliant: Get to lay out some complicated looking trees with structures of arrays of structures of whatever elementary data types, and, still, ALL the addressing is just from the standard array addressing logic. And get to set the array bounds during execution via Automatic, Controlled, or Based -- powerful stuff. Then in tasking Controlled is tasked based so goes away on its own when not wanted.
(5) Exceptional condition handling in PL/I is gorgeous.
I like old Basic, Algol, Fortran, PL/I, the scripting language Prime used, the scripting language CMS on CP67 used, Rexx, Open Object Rexx, Kexx (with KEdit), the .NET version of Visual Basic. Is that enough? Oh, might as well consider TeX -- terrific stuff. I will probably like Power Shell when I take time out to learn enough of it. Am I out of the dog house now? Am I permitted to have a cookie, please?