Forum > General

[SOLVED] Type conversion?

<< < (4/4)

PascalDragon:

--- Quote from: egsuh on August 15, 2022, 01:04:54 pm ---Thank you for your advices.  This compiles in {$mode objfpc}.
Haven't tested running yet. I'll post the result.

--- End quote ---

Please report this as a bug then.

As a workaround you can also use Val instead of ReadStr if the whole string only contains the enum value:


--- 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";}};} ---var  ts: String;  anIT: TInputTypes;  code: Integer;begin  ts := 'itText';  Val(ts, anIT, code);  if code <> 0 then    // there was an error  else    // ok    ;end.

egsuh:

--- Quote ---Please report this as a bug then.
--- End quote ---

It compiles well in {$mode objfpc}. Do you mean to report a but, because it does not compile in {$mode delphi}?

PascalDragon:

--- Quote from: egsuh on August 17, 2022, 05:19:32 am ---
--- Quote ---Please report this as a bug then.
--- End quote ---

It compiles well in {$mode objfpc}. Do you mean to report a but, because it does not compile in {$mode delphi}?

--- End quote ---

Yes, because it should compile with a different $PackEnum setting as well (which is where mode ObjFPC differs from Delphi). After all the user might not be able to control where the enum comes from.

Navigation

[0] Message Index

[*] Previous page

Go to full version