Recent

Author Topic: what's the difference between String, string, ustring?  (Read 2268 times)

afidegnum

  • New member
  • *
  • Posts: 9
what's the difference between String, string, ustring?
« on: September 09, 2018, 10:58:05 am »
I have been trying but can't figure out,

what's the difference between String, string and ustring

Thaddy

  • Hero Member
  • *****
  • Posts: 10293
Re: what's the difference between String, string, ustring?
« Reply #1 on: September 09, 2018, 11:31:48 am »
There is no difference between String and string or STRING. Pascal is not case sensitive.
ustring is probably a user defined string type coming from a C or c++ translation and likely to mean the Pascal widestring type. Can you show us where you found ustring?
« Last Edit: September 09, 2018, 12:33:56 pm by Thaddy »
I am more like donkey than shrek

MacWomble

  • Jr. Member
  • **
  • Posts: 77
Re: what's the difference between String, string, ustring?
« Reply #2 on: September 09, 2018, 01:58:01 pm »
ustring is e.g used here:
http://wiki.freepascal.org/fpCEF3
Mint 19.3 Cinnamon, FPC/ Lazarus Trunk 64Bit

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8603
  • FPC developer.
Re: what's the difference between String, string, ustring?
« Reply #3 on: September 09, 2018, 02:03:46 pm »
Without knowing fpcef3, I think it is just some alias of normal string types depending on ifdef, to simplify versioning. (Delphi-old, delphi-unicode and FPC/Lazarus)

Thaddy

  • Hero Member
  • *****
  • Posts: 10293
Re: what's the difference between String, string, ustring?
« Reply #4 on: September 09, 2018, 03:16:09 pm »
ustring is e.g used here:
http://wiki.freepascal.org/fpCEF3
It is declared as:
Code: Pascal  [Select][+][-]
  1. Type
  2.   {$IFDEF CEF_STRING_TYPE_UTF8}
  3.     ustring = UTF8String;
  4.   {$ELSE}
  5.     ustring = UnicodeString;
  6.   {$ENDIF}
I wonder if the declarations are correct. E.g. imho it should be widestring, not unicodestring: CEF has no knowledge about refcounted strings and this can cause problems even if they are assignment compatible.
That said: I use this package myself and it is stable.
« Last Edit: September 09, 2018, 03:38:52 pm by Thaddy »
I am more like donkey than shrek

 

TinyPortal © 2005-2018