[fpc-devel] About the var param in CreateConsoleScreenBuffer

Martin Frb lazarus at mfriebe.de
Thu Nov 9 13:59:32 CET 2023


Fpc defines
function CreateConsoleScreenBuffer(dwDesiredAccess:DWORD; 
dwShareMode:DWORD; var lpSecurityAttributes:SECURITY_ATTRIBUTES; 
dwFlags:DWORD; lpScreenBufferData:LPVOID):HANDLE; external 'kernel32' 
name 'CreateConsoleScreenBuffer';

`lpSecurityAttributes` is a `var` param in the above. But 
https://learn.microsoft.com/en-us/windows/console/createconsolescreenbuffer 
states that the param is optional and can be null/nil.
var param don't accept nil. So this should be a pointer instead.

Yet,  this was reported in 
https://gitlab.com/freepascal.org/fpc/source/-/issues/5836
That issue got closed "*Fixed in version:* 1.9.9"
Only "git blame" shows no change to that line ever. (Well afaik some 
commits are not in git, so could be).

So the question is: Was it fixed and broken again? Was it fixed but not 
committed?
Or does the cryptic comment
>
> Pascal CONST can be both by reference (thus consuming a *) or by value.
>
> This is the only safe way.
>
mean its a "wont fix" ?
And if that is the case, then what does this comment mean?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20231109/f3795b1b/attachment.htm>


More information about the fpc-devel mailing list