org.sonar.l10n.delphi.rules.community-delphi.AddressOfNestedRoutine.html Maven / Gradle / Ivy
Why is this an issue?
Nested routines cannot be used as procedural values.
This will normally cause a compilation error, but such errors can be bypassed by using the address
of the nested routine with @
.
In this scenario, the code generated by compiler will have undefined behavior.
How to fix it
Do not use @
to get the address of a nested routine. If a method pointer is required,
convert the nested routine into a top-level routine.
Resources
-
RAD Studio documentation: Method Pointers
-
Embarcadero Quality Portal: Code generation for is wrong for calling nested routines supplied as parameters
-
Embarcadero Quality Portal: Local values not properly compiled in Nested Function
-
Stack Overflow: Why cannot take address to a nested local function in 64 bit Delphi?
© 2015 - 2024 Weber Informatics LLC | Privacy Policy