Forum > Beginners
[SOLVED] EArgumentNilException - Compilation error with FPC 3.0.0
julkas:
Using EArgumentNilException with FPC 3.0.0 causes compilation error (mode objfpc) - https://ideone.com/5BAO1H. On my development environment - Lazarus - 2.0.0, FPC - 3.0.4 it's OK! What is workaround?
Thanks.
Thaddy:
3.0.0 is not supported. The work-around is 3.0.4 or higher.
Or simply raise exception.create('Set is empty.').
Or declare EArgumentNilException yourself...
BTW: Ideone should use more up-to-date compilers.
nouzi:
TRY this basd on 3.0.2
https://www.tutorialspoint.com/compile_pascal_online.php
julkas:
OK. I also use raise exception.create('Set is empty.') on Ideone.
Is there any way write backward compatible code (mode objfpc) with EArgumentNilException?
--- 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";}};} ---class function TTreapNode.Min(node: TTreapNode): T;begin if node = nil then raise EArgumentNilException.Create('Set is empty.'); while node.FLeft <> nil do node := node.FLeft; Exit(node.FKey);end;
Thanks.
Xor-el:
--- Quote from: julkas on March 10, 2019, 02:40:49 pm ---OK. I also use raise exception.create('Set is empty.') on Ideone.
Is there any way write backward compatible code (mode objfpc) with EArgumentNilException?
--- 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";}};} ---class function TTreapNode.Min(node: TTreapNode): T;begin if node = nil then raise EArgumentNilException.Create('Set is empty.'); while node.FLeft <> nil do node := node.FLeft; Exit(node.FKey);end;
Thanks.
--- End quote ---
Thaddy already answered you.
see my modification to your Ideone code below
--- 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";}};} ---{$mode objfpc}program ideone; uses SysUtils; typeEArgumentNilException = class(Exception); begin raise EArgumentNilException.Create('Set is empty.');end.
Navigation
[0] Message Index
[#] Next page