Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2020-08

Dwarf and "Result"

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

I just noted (testing with 3.3.1 from 2 or 3days ago) that -gw adds 3 variables for result
"result"
"FUNCTIONNAME"
"RESULT"

Why an upper, and lowercase result?

Not tested with dwarf-3
Not tested with older fpc

Win64

Regards
Martin

Reply by email

Jonas Maebe
to Martin
Martin wrote 7 lines
I just noted (testing with 3.3.1 from 2 or 3days ago) that -gw adds 3 variables for result "result" "FUNCTIONNAME" "RESULT" Why an upper, and lowercase result?

"result" is the actual function result parameter.

"FUNCTIONNAME" is an alias (internally an "absolute" variable") for "result".

"RESULT" is an alias (idem) for "result" that only gets created if
{$modeswitch result} is active.

Lowercase variables cannot be accessed directly by Pascal code, and only by the compiler itself (or through absolute aliases).

Jonas

Reply by email

Martin Frb
to Jonas Maebe
Jonas Maebe wrote
Lowercase variables cannot be accessed directly by Pascal code, and only by the compiler itself (or through absolute aliases).

Gdb shows all 3 values in the locals
-stack-list-locals

So the double "result"/"RESULT" is irritating.

Anyway its not a major issue. I just wanted to mention it, in case it was by accident.

---
Btw, using DWARF 3, it shows as "$result"/"RESULT"

And the variable  FUNCTIONNAME, is all uppercase. Despite all other identifiers in DWARF 3 are in the declared case. (The FunctionName for the function itself, is correctly cased too)
So it seems there is an old uppercase() left over somewhere.

"RESULT" is also all upper, but there is no declaration by the user, from which to take any other case info.

(tested with 3.3.1 from last week)

Reply by email