[fpc-devel] QueryInterface on linux/i386 - adding 'in' parameter type?
Michael Van Canneyt
michael at freepascal.org
Sun Aug 29 17:35:42 CEST 2010
On Sun, 29 Aug 2010, Jonas Maebe wrote:
> On 29 Aug 2010, at 16:54, Michael Van Canneyt wrote:
>> His change would mean that the GCC compiler does things which we currently know nothing about, namely it pushes const parameters by reference in some cases.
> No, the problem is many people (wrongly) use "const" in Pascal as an equivalent for "type const *" (= the unclean "const type *") of C, mostly for lack of a better alternative.
When in fact they should declare it as
const P : ^type
? (knowing fully that this is semantically not quite the same)
This of course means that they must always provide the @ when calling this method.
In that case, to be more clean, I think it is better to simply correct the declarations
and not to mess with the argument types at all.
Hm. A difficult problem in the case of the interface, since it would require adapting
existing pascal code to match C semantics. Maybe your proposal is not so bad after all,
using "constref"; at least that would make it very explicit.
More information about the fpc-devel