home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,282 of 2,978   
   Wolf Behrenhoff to RadSurfer   
   Re: This is terrible! TP 5.5   
   04 Feb 05 11:11:14   
   
   From: NoSpamPleaseButThisIsValid2@gmx.net   
      
   RadSurfer wrote:   
   >   
   > The following FAILS!   
   >   
   > Const   
   >     BUFSIZ: Integer = 256;           { Accepted. }   
      
   This is NOT a constant but an initialised variable!   
   To use this in a type definition, it must be a true constant:   
      
   const   
      BUFSIZ = 255;   
      
   > type   
   >     StructBuffer = record            { should there be a ; here? isn't   
   > needed}   
   >     Buffer0: String[BUFSIZ];         { Illegal Expression?!?! Say What?   
   > }   
      
   Because   
   a) BUFSIZ is not a constant   
   b) BUFSIZ > 255   
      
   Strings can have a maximum length of 255 chars. This is a limitation in   
   old TPs. In TP7 (or before?) the type PChar was introduced for   
   zero-terminated strings. PChar - like old C style char[] strings - also   
   have disadvantages. Most important: they may not contain #0 as this   
   marks the end. And length(c-string) is an expensive operation.   
      
   In modern Pascal compilers (like Delphi and FreePascal), new string   
   types like "AnsiString", "WideString" are used which can be up to 2 GB   
   long and may contain #0. Also length() is a O(1) operation.   
      
   >     Buffer1: String[256];            { FAILS! String too large   
   > apparently }   
   >     Buffer2: Char[256];              { Char is not a reserved word! }   
   > end;   
      
   What is Char[256] supposed to mean? An array?   
      
   > OK: Solution?   
   > Create pointers to type "unsigned char" which can then be assigned   
   > later on   
   > to point to the actual Buffers ram-space!   
      
   What do you want to achieve?   
      
   > I just might abandom this early at this rate until I can manage to   
   > find TP 7.x, or better yet BP 7.x.  At least then I'll also have   
   > genuine   
   > Asm blocks, and far better Loop control!   
      
   Why don't you try for example FreePascal?   
      
   > Point me to these web-based TPascal Tutor sites... I can not seem to   
   > find them.   
   > Either 5.5 sites are just gone now; but even finding 7.0 stuff seems   
   > tricky.   
      
   Even TP 7 is from 1992! This is now 13 years ago! 13 years are AGES in   
   computer development.   
      
   Wolf   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca