3 ms·
Speaking of few differences from C and busted string semantics: my least favorite thing about Pascal is that strings and some types are 1-indexed, but dynamic a
by loeg 9y ago
Speaking of few differences from C and busted string semantics: my least favorite thing about Pascal is that strings and some types are 1-indexed, but dynamic arrays are 0-indexed.
https://stackoverflow.com/questions/4083356/array-begin-from-0-or-1-in-delphi-5-0-pascal https://stackoverflow.com/questions/4083356/array-begin-from...
- yardshop 9y agoAnd the string length is in the 0 byte, meaning no strings longer than 255 bytes. At least in old Turbo Pascal anyway!
- clouddrover 9y agoYes, this is not a limitation in Free Pascal or Delphi. The ShortString type still exists and is limited to 255 bytes. But the AnsiString, WideString, and UnicodeString types are variable length and can be up to 2 gigabytes: http://docwiki.embarcadero.com/RADStudio/Berlin/en/String_Types_(Delphi) http://docwiki.embarcadero.com/RADStudio/Berlin/en/String_Ty...
- yuhong 9y agoIn the case of classic Mac OS it was part of the API.
- pjmlp 9y agoWith 640 KB it wasn't as there was a lot of space to have bigger strings. Besides, there were arrays as well, and TPW had safer strings without that limitation PCharStr.
- kabdib 9y agoOh lordy, I'd forgotten the array index thing. That was painful.
- clouddrover 9y agoThe Low and High compiler intrinsics make array indexes easy to deal with. You don't need to care about the indexing to iterate over the array. You just go from Low(array) to High(array): http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Low http://docwiki.embarcadero.com/Libraries/Berlin/en/System.Lo...
- clouddrover 9y agoAnd an annoying difference between the desktop and mobile compilers for Delphi is that on desktop strings are 1-indexed as they've always been but on mobile strings are 0-indexed: http://docwiki.embarcadero.com/RADStudio/Berlin/en/Migrating_Delphi_Code_to_Mobile_from_Desktop http://docwiki.embarcadero.com/RADStudio/Berlin/en/Migrating...
- pjmlp 9y agoComing from Basic that wasn't a problem. It always felt quite natural to me.