Forum > General

Pos('/text', S) thinks that it is Pos(WideString, AnsiString)

(1/3) > >>

AlexTP:
Free Pascal Compiler version 3.2.3-660-g9b2ba834a6 [2022/08/18] for x86_64
Linux

For Pos('/text', StrVar) Lazarus IDE thinks that it is overload Pos(WideString, AnsiString). This gives little slower code! Can be avoided?

KodeZwerg:
You can Cast your desired type "string('data'), otherString" or make it a variable to insert.

JuhaManninen:

--- Quote from: AlexTP on December 01, 2022, 11:15:18 am ---For Pos('/text', StrVar) Lazarus IDE thinks that it is overload Pos(WideString, AnsiString). This gives little slower code! Can be avoided?

--- End quote ---
How did you verify it?
'/text' should be interpreted as UTF-8 string when the default Unicode support is in action.
 https://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus
Then the overload should be Pos(AnsiString, AnsiString).
Actually it can be interpreted as any 8-bit codepage and AnsiString overload is used.

AlexTP:
I verify it only by IDE - by floating tooltip, by 'go to definition' into FPC src.

Is it IDE bug that it thinks about wrong overload?

Lazarus 2.3.0 (rev main-2_3-1386-g23b2324f9f) FPC 3.2.3 x86_64-linux-gtk2

KodeZwerg:
In attachment you see what the Lazarus IDE is using for me while just typing that:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; {$IFDEF MSWINDOWS}{$APPTYPE CONSOLE}{$ENDIF} {$R *.res} var  s: string;begin  Pos('...',end. 

Navigation

[0] Message Index

[#] Next page

Go to full version