Grant Jacobs gjacobs at bioinfotools.com
Tue Apr 29 12:29:33 CEST 2003

Intuition tells me that CString is a 'C' string, as in the 
programming language 'C' (or a 'char *' if you want the C type 
definition). In C, these can be treated as either pointers or as 
character arrays (to cut a long story short). They are terminated 
with a \0  (if used correctly, that is: one of the "standard" buggy 
things to do in C is lose the terminating \0 which can cause all 
sorts of trouble. The Dest[size] := #0 example you gave is doing the 
"safe" thing of insisting that the string be terminated correctly.).

Its almost certainly compatible with Apple's CStringPtr = ^char ; as 
the point of these is C compatibility usually...

Usually characters are byte-sized in C. There are also wide 
characters, but that's another story again...

But we can want for Frank's definitive answer and the usual 
nitpicking of my sloppy answer :-|


At 6:32 AM +0000 29/4/03, Peter N Lewis wrote:
>Could someone explain o me what CString is in the RTS?
>It seems it is a pointer, and the docs somewhere describe it as 
>^Char, and it is generally used as a pointer, but some places it is 
>used as an array, as in   Dest[Size] := #0;
>Since there seems good support for CString in string.pas, I'm trying 
>to figure out if I can use it in the Mac Interfaces, if it is binary 
>compatible with the Mac's definition of CStringPtr = ^Char;
>BTW, I noticed in string.pas
>     if (s2 = nil) or (s2^ = #0)
>I know GPC defaults to always doing short circuit, but would that be 
>better written or_else?
>    Peter.
><http://www.interarchy.com/>  <http://documentation.interarchy.com/>

Grant Jacobs Ph.D.                                     BioinfoTools
ph. +64 3 476 1820  (office, after 10am)               PO Box 6129,
or  +64 25 601 5917 (mobile)                               Dunedin,
gjacobs at bioinfotools.com                               NEW ZEALAND.
    Bioinformatics tools: deriving knowledge from biological data
Bioinformatics tools - software development - consulting - training
Check out the website for more details: http://www.bioinfotools.com

The information contained in this mail message is  confidential and
may  be legally privileged. Readers of this message who are not the
intended recipient are hereby notified that any use, dissemination, 
distribution or reproduction of this message is prohibited. If  you
have received this message in error please notify the sender immed-
iately and destroy the original message.  This applies also to  any
attached documents.

More information about the Gpc mailing list