From: marcov@stack.nl   
      
   On 2004-11-11, VBDis wrote:   
   > Im Artikel <8b0a868e.0411090459.33d9a600@posting.google.com>,   
   > Ruud.Baltissen@abp.nl (Ruud Baltissen) schreibt:   
   >   
   >>This raises the question: how far must compatibilty go?   
   >   
   > In another thread (other group) I just read the following:   
      
   > From the Pascal User Manual & Report (pg 138)   
   >   
   > ". . . Strings consisting of a single character are the constants of the   
   > standard type char . . . Strings consisting of n (>1) enclosed characters   
   > are the constants of the type . . .   
   >   
   > packed array [1 .. n] of char"   
      
   He is talking about BP compatability, so I think he should first choose   
   if he goes the ISO way, and does some BP extensions, or goes for full BP   
   compat, or a mode concept that tries to perfect both.   
      
   > Please note the array dimension, starting at 1. The compiler most probably   
   > uses the element [0] to store the length of the string. In fact it doesn't   
   > cost any byte more to explicitly store the string length in a leading   
   > byte, as opposed to an trailing zero character. A length byte has several   
   > advantages:   
      
   IIRC the original pascal strings were space padded from the end.   
      
   > 1) The string length can be determined immediately, without searching for an   
   > zero terminator.   
   > 2) String literals can include Chr(0).   
   > 3) String variables can use the same encoding.   
      
   > Zero-terminated strings instead only have one advantage: they are shorter   
   > when the string length is > 255 characters, in which case a single byte is   
   > not sufficient to hold the string length.   
      
   And only in the case the (length mod heapmgrgranularity)
|