Jon,

You are wrong.

C has always had support for fixed length strings (aka char[]).   The
XLC/C++ compiler will inline MVC, MOVS, etc inplace of memcpy() and
strcpy().   And it knows how to write unrolled MVC loops for a run-time
length argument variable.

Not to mention that with C++ you can use std::string or write your own with
whatever implementation you want.


Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Tue, Jan 30, 2018 at 11:27 AM, Jon Perryman <[email protected]> wrote:

>
>
>     On Tuesday, January 30, 2018 8:05 AM, Paul Gilmartin <
> [email protected]> wrote:
>
>
>  > Gil wrote: > Which of the two is to blame for null-terminated
> strings?  > (Or was it BCPL?)
>
> Exactly my point. I suspect that the C group considered Null-terminated
> strings cost exactly the same as fixed length fields. Ask a C program to
> code MVC (memcpy) and string copy (strcpy) in C (not assembler). MVC is
> loop thru each byte until length reached.  String copy is loop thru each
> byte until X'00'. As an FYI, MVC could be faster in some situations.
> Regards, Jon.
>

Reply via email to