tw20962.pp 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. { %opt=-gh }
  2. {$ifdef go32v2}
  3. {$define USE_INTERNAL_UNICODE}
  4. {$endif}
  5. {$ifdef USE_INTERNAL_UNICODE}
  6. {$define USE_FPWIDESTRING_UNIT}
  7. {$define USE_UNICODEDUCET_UNIT}
  8. {$define USE_CPALL_UNIT}
  9. {$endif}
  10. program outpar;
  11. {$ifdef FPC}{$mode objfpc}{$h+}{$endif}
  12. {$ifdef mswindows}{$apptype console}{$endif}
  13. uses
  14. {$ifdef FPC}
  15. {$ifdef unix}
  16. cthreads,
  17. {$ifndef USE_INTERNAL_UNICODE}
  18. {$ifdef darwin}iosxwstr{$else}cwstring{$endif},
  19. {$endif ndef USE_INTERNAL_UNICODE}
  20. {$endif}
  21. {$endif}
  22. {$ifdef USE_UNICODEDUCET_UNIT}
  23. unicodeducet,
  24. {$endif}
  25. {$ifdef USE_FPWIDESTRING_UNIT}
  26. fpwidestring,
  27. {$endif}
  28. {$ifdef USE_CPALL_UNIT}
  29. cpall,
  30. {$endif}
  31. sysutils;
  32. {$ifndef FPC}
  33. type
  34. sizeint = integer;
  35. psizeint = ^sizeint;
  36. {$endif}
  37. procedure testproc(out str);
  38. begin
  39. ansistring(str):= '';
  40. end;
  41. var
  42. str1,str2: ansistring;
  43. begin
  44. setlength(str1,5);
  45. move('abcde',str1[1],5);
  46. str2:= str1;
  47. testproc(str2);
  48. if StringRefCount(str1) <> 1 then
  49. Halt(1);
  50. if str1<>'abcde' then
  51. Halt(2);
  52. end.