C++ is an extension to C. It provides managed strings via a class named, 
appropriately enough, string. I would assume that the various string methods 
use "defined length" technology analogous to memcpy(). string is largely immune 
to buffer overruns.

Even if you don't like object-oriented programming in general, C++ so 
compatible with C that one could maintain the majority of one's C coding 
techniques and styles while changing from C-style strings to C++ managed 
strings.

C++ has been around since 1985. It's probably time to stop bashing C for its 
string shortcomings. It's a little like bashing COBOL because it does not have 
dynamic memory allocation and pointers (COBOL-85, that is). 

I know the White House does many things but I did not know that they were now 
making programming language recommendations.

Oh, and BTW, strcpy. C is case-sensitive.

Charles

On Thu, 14 Nov 2024 00:25:01 +1100, Clement Clarke <[email protected]> wrote:

>Rick Troth, I wonder if you could run this small C program on a Z series
>machine?
>
>The program is on https://start.oscar-jol.com/fast-safe-c-strings
>
>It is called   Strcpy_Speed_Test.c  on the above page
>
>I have run it on Windows and the JCC compiler on Hercules MVS
>
>The Windows code is about 6 times slower than a straight memcpy.
>The Hercules C code is about 30-40 times slower.
>
>With Google using terrawatts of electricity and billions of gallons of
>cooling water speed of processing is vital.  Presumably Microsoft uses
>similar amounts of both.
>
>I would imagine that a lot of string processing is done shifting billions
>(?) of text based emails around the world each day.
>
>A similar test with PL/I F on Hercules showed code of a single MVC which is
>about as fast as you can get.
>
>I also notice that the White House is suggesting that programs be written
>in something other than C.  C is too dangerous.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to