[comp.sys.mac] anomoly in LightspeedC include file?

frankng@basser.UUCP (04/22/87)

After getting some inconsistent results during program development, I
found what seems to be suspect code in the *MacTypes.h* file of
LightspeedC (v2.01).  It is the definition of StringHandle and
StringPtr types.  In the file it has:
	...
	typedef unsigned char Str255[256];
	typedef unsigned char * StringPtr,** StringHandle ;
	...
whereas in page 78 of IM Vol 1 it states:
	...the Memory Manager includes the following definitions:
	TYPE	Str255		= STRING[255];
		StringPtr	= ^Str255;
		StringHandle	= ^StringPtr;
	...

Would some helpful being out there please tell me if this would cause
anomalies in programs using string functions (and syntax error,
especially with the LightspeedC pointer checking turned on).

There are a few cases where this can cause confusion, if not errors.
For example the Toolbox function *NewString*, which returns a
StringHandle.  Does this return a handle to a C string or a Pascal
string (with the length byte at the beginning)? 

Thanks in advance for any help.
-- 
Frank Ng			ACSnet:	frankng@basser.oz
Department of Computer Science	ARPA:	frankng%basser.oz@seismo.css.gov
University of Sydney NSW 2006	UUCP:	seismo!munnari!basser.oz!frankng
AUSTRALIA

clubmac@runx.ips.oz (Macintosh Users Group) (04/24/87)

In article <904@basser.oz> frankng@basser.oz (Frank Ng) writes:
>
>
>There are a few cases where this can cause confusion, if not errors.
>For example the Toolbox function *NewString*, which returns a
>StringHandle.  Does this return a handle to a C string or a Pascal
>string (with the length byte at the beginning)? 
>

On page 12-2 of the Lightspeed C Manual, it states under the heading of
"strings" that "Pascal strings are required when calling Macintosh routines..."

This means that EVERY Macintosh toolbox routine that returns a pointer or
handle to a Str255 use Pascal strings.

Jason Haines

Club Mac Macintosh Users Group of Sydney
Snail:     Box 213, Holme Building, Sydney University, NSW, 2006, Australia
ACSnet:    clubmac@runx.ips.oz	   ARPA:   clubmac%runx.ips.oz@seismo.css.gov
UUCP:{enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!runx.ips.oz!clubmac