The sizeof() a char* in any C implementation is the size of an address (4,
8, or formerly 2 bytes). A char* IS an address, of course.

sizeof() is resolved at compile time. If you think about it, there is no way
the compiler could know how long a string a char* is going to be pointing
to. That's why you need strlen(), which is a run time function.

If you look in the compiler library doc it should for memcpy() tell you the
required header and any required macro switches. For the "regular" C that is
#include <string.h>.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Don Poitras
Sent: Monday, January 11, 2021 3:23 PM
To: [email protected]
Subject: Re: Compile error and also possible library bug with Metal/C
metal.h

I've never used Metal C, but for the first problem (undeclared __MEMSET), I
would look to see if there's a string.h that can be used. That's normally
where memcmp is defined.

As for the runtime problem, I'd guess it had something to do with using 
'sizeof' incorrectly. It looks as if you are compiling 64-bit which would
mean that 'sizeof(xarg)' is going to be 8. If you replace all the sizeofs
with strlens, I think you'd see it work.

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

Reply via email to