View Issue Details

IDProjectCategoryView StatusLast Update
0031527LazarusLCLpublic2017-09-03 22:11
ReporterBenito van der Zander Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionreopened 
Product Version1.7 (SVN) 
Summary0031527: var/out winapi parameters: GetCursorPos, GetCaretPos, GetWindowRect
DescriptionMany functions in lcl/include/ have a var parameter, even though the function only uses it as out parameter, which leads to pointless warnings. E.g. GetWindowRect, GetCursorPos, GetCaretPos
TagsNo tags attached.
Fixed in Revision
Attached Files


duplicate of 0029948 resolvedOndrej Pokorny Lazarus GetTextMetrics() declaration - avoid unneccessary hint 
related to 0029946 resolvedMarco van de Voort FPC GetTextExtentPoint32W() declaration 
related to 0032369 resolvedOndrej Pokorny Lazarus Declare out parameters as out, no var 


Ondrej Pokorny

2017-03-13 11:28

developer   ~0098870

Please search for existing bug reports before sending new.

This will never be changed. See the duplicate bug report for more info.

Benito van der Zander

2017-03-14 00:29

reporter   ~0098894

That makes no sense.

Only managed types like strings are finalized. WinAPI records do not contain managed types.

Ondrej Pokorny

2017-03-14 07:26

developer   ~0098896

Please use the mailing list for discussion.

Benito van der Zander

2017-03-16 23:21

reporter   ~0098952

There you made a good suggestion in your first comment in regarding looking for duplicates.
Now I have found the almost duplicate 0029946.
It seems that bug is where the discussion takes place.

Probably Lazarus copied those incorrect headers from FPC's windows API unit, where they were incorrect because that unit predates having the out parameter in the language. But the LCL is younger than the RTL.

Ondrej Pokorny

2017-03-16 23:36

developer   ~0098953

Unassigning myself.

jamie philbrook

2017-03-18 22:00

reporter   ~0099035

May I make a suggestion ?

 This would involve a compiler switch or code change along
with a change in code tools.

 Allow the use of "OUT" as you use the function/Procedure as
a form of cast.
A Procedure defind as GetSomething(Var I:Integer);

used as
 GetSomething(OUT SomeIneger);

 The compiler can examine prototype for the use of OUT or VAR, if
ether is true, treat the field as OUT or VAR, what ever makes
the compiler happy and also have code tools not complain about unassigned

 This way the coder can place the OUT in there so to inform code tools or
compiler that the uninitialized variable does not matter.

 Just an idea.

Ondrej Pokorny

2017-03-18 22:10

developer   ~0099036

There is this concept already. No need for a new suggestion: GetSomething(SomeInteger{%H-});

Or disable the hint type in project options.

jamie philbrook

2017-03-19 03:38

reporter   ~0099045

Yes, that was a good tip, I just went though a major source code list trying
that out. {%H-} just a head of the parameters complaining.
 I don't think anything else needs to be done here...

Issue History

Date Modified Username Field Change
2017-03-12 20:34 Benito van der Zander New Issue
2017-03-13 11:28 Ondrej Pokorny LazTarget => -
2017-03-13 11:28 Ondrej Pokorny Note Added: 0098870
2017-03-13 11:28 Ondrej Pokorny Relationship added duplicate of 0029948
2017-03-13 11:28 Ondrej Pokorny Status new => resolved
2017-03-13 11:28 Ondrej Pokorny Resolution open => duplicate
2017-03-13 11:28 Ondrej Pokorny Assigned To => Ondrej Pokorny
2017-03-14 00:29 Benito van der Zander Note Added: 0098894
2017-03-14 00:29 Benito van der Zander Status resolved => assigned
2017-03-14 00:29 Benito van der Zander Resolution duplicate => reopened
2017-03-14 07:26 Ondrej Pokorny Note Added: 0098896
2017-03-14 07:26 Ondrej Pokorny Status assigned => resolved
2017-03-14 07:26 Ondrej Pokorny Resolution reopened => duplicate
2017-03-16 23:21 Benito van der Zander Note Added: 0098952
2017-03-16 23:21 Benito van der Zander Status resolved => assigned
2017-03-16 23:21 Benito van der Zander Resolution duplicate => reopened
2017-03-16 23:34 Ondrej Pokorny Assigned To Ondrej Pokorny =>
2017-03-16 23:36 Ondrej Pokorny Note Added: 0098953
2017-03-16 23:36 Ondrej Pokorny Status assigned => new
2017-03-17 08:49 Juha Manninen Relationship added related to 0029946
2017-03-18 22:00 jamie philbrook Note Added: 0099035
2017-03-18 22:10 Ondrej Pokorny Note Added: 0099036
2017-03-19 03:38 jamie philbrook Note Added: 0099045
2017-09-03 22:11 Ondrej Pokorny Relationship added related to 0032369