Forum > General
DebugInfo: wrong line numbers on variables init ?
(1/1)
Arioch:
See screenshots, see RAX register value.
VAR-init is being executed, but CONST-section is instead emitted into the DebugInfo
Win64 trunk FPC/Laz, DWARF 3 mode
--- 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";}};} ---procedure Test(const Recur: integer);const cVar: integer = 30;var initted: integer = 20; regular: integer;begin Inc(regular);
A tangential question: since there is anyway the code lines explicitly emitted, why limiting it to constant values, why not allowing a full-fledged expressions, like
--- 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 gVar: integer = 10; function M(): integer; begin result := gVar + 100; end; procedure Test(const Recur: integer);const cVar: integer = M(); // 30;var initted: integer = M();// 20;
Implementing this would probably be naturally re-used later when you would be implementing Delphi XE11's Scoped/Inline variables.
Navigation
[0] Message Index