On Sat, 23 Aug 2025 12:40:59 -0500, Jon Perryman <[email protected]> wrote:
>Until IBM makes PLS available outside IBM, we must live with the compilers we
>are given. Those compilers have major flaws. For instance, I think the
>alternative to PLS is HLASM. C has major flaws like memcpy(a, b, 7) calling a
>generic program instead understanding the "7" should use MVC instruction. As
>an FYI, Cobol recognizes the 7 and handles it appropriately. GO is only 15
>years old but only fixed a few C flaws in it's implementation. As far as I
>know, Java also has generic routines. For application
Partly true. I was curious about this, so I tested. For
char a[7] = "foo";
char b[7] = "bar";
memcpy(a, b, 7);
At optimization levels 0 and 1, it did indeed load 7 into a register and make a
call to a generic memcpy() routine. At optimization level 2, the compiler was
smart enough to figure out that a was never referenced, and cleverly skipped
the whole thing! So I added
printf("%s", a);
following the above and -- sorry if this disappoints you -- the IBM XLC V3R1
compiler simply generated
D206 9868 9870
Charles
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN