Subject: | |
From: | |
Reply To: | |
Date: | Fri, 25 Oct 1996 11:31:26 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Oct 25, 8:51am, Dr. Ferenc Nagy wrote:
snip...
> It might be true if the compiler passes the address of the first string
> element to the intrinsic instead of the address of the string length.
It is true. And this can sometimes bite you if you forget. The compiler
adds 4 bytes to the *string* that you pass to all intrinsics that
expect a byte address for a parameter. This addition is not done for
character arrays, for instance, only for Pascal strings. Where this
feature can be surprising is when you call an intrinsic that expects a
Pascal-like string (namely, 4 byte length followed by an array of chars),
and you want to pass it a Pascal string, but the
compiler adds 4 bytes to the address behind your back and so the intrinsic
doesn't see the strlen. I work around this
by using type_coercion to make the compiler think I'm just passing a
byte address. A case variant record would suffice too.
regards,
Jeff Vance, CSY
--
|
|
|