I havent tracked this discussion, but its just possible that you may 
have missed the significance of H+ (if using D3+).  If the compiler 
option is H-, then string == shortstring.  If it is H+ then 
string==ansistring.  If using D3+, you should never use string as the 
type, always qualify it as shortstring or ansistring.  Note that 
string[8] is automatically shortstring.

The compiler has a serious bug, which will kick in if you are using 
string for type definition.  Theoretically the compiler does auto 
conversions etc between the two string types.  It fails however when 
the declaration is in another unit.

For example, unit A defines

  {$h-}

  var 
    AString : string
    
Every reference to AString in unitA is as a shortstring.  Which is 
fine.  Now enters unit B.

  {$h+}

  var
    BString : string;

BString is an ansistring.  But because AString was defined in unit A,
its definition as visible to unit B is "string".  Because unit B has
h+, it treats AString as an ansistring.  Any interaction between
AString and BString is doomed to failure.  This normally manifests
itself as missing characters in the string.

Whats worse are function/procedure definitions, especially from 3rd 
part libraries where the beggars have been lazy and used string to 
define things.  Anyone with any clout, please kick some backsides - 
starting with Borland, Infopower, Turbopower ......


On 15 Apr 99 at 7:53, Jeremy Coulter wrote:

> AH POOH !!!  .....ah well, that wont be too hard to work with....thanks.....
> 
> 
> Jeremy Coulter
> 
> -----Original Message-----
> From: Aaron Scott-Boddendijk [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 15, 1999 9:41 AM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Passing record structures
> 
> 
> >Ok , well using string[255] worked fin. I think mor original problem was
> >that I was not putting a "@" at the begining of what was to be written to
> >the socket in buffer form. i.e.
> ...
> >I am not sure if I this still works but just using a string rather than a
> >fixed length string, but I will know tonight when I get home I guess.
> 
> 
> The answer is no it shouldn't.
> 
> here are 2 record definitions
> 
> type
> TA = record
>   X,Y :Integer;
>   N :String;
> end;
> 
> TB = record
>   X,Y :Integer;
>   N :String[8];
> end;

Rohit

======================================================================
CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand
PH    (649) 489-2280 
FX    (649) 489-2290
email [EMAIL PROTECTED]  or  [EMAIL PROTECTED]
======================================================================

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to