HP3000-L Archives

October 1996, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jeff Vance <[log in to unmask]>
Reply To:
Jeff Vance <[log in to unmask]>
Date:
Fri, 25 Oct 1996 11:31:26 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (23 lines)
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

--

ATOM RSS1 RSS2