inno setup - Pascal (Script) and exception control flow -
i'm working pascalscript innosetup installer, , fail see control of following block flowing.
function foo(): string; begin result := 'foo'; raiseexception('...'); end; procedure test(); var z : string; begin z := ''; try z := foo(); except log(z); end end;
my installer seems indicate z
being set result
of foo
function. understanding of exceptions in 'most' programming languages tells me assignment z := foo()
should not happen in case of exception.
when foo
function raises, should z
still assigned to?
probably handles result values reference implicit first argument. can happen. considered legal of codegeneration/optimization, since quite common way of handling return values.
however defined in object pascal outside testing delphi murky territory, since there x86 , x86_64 implementation. , delphi return value in eax, if follow logic illegal.
added later:
i tested delphi structured types, , while passes reference, creates copy on stack pass it.
this make hard optimize code structured types though, modifier/attribute declare return type const fix if ever needed.
Comments
Post a Comment