[fpc-devel] "Default" discussion for SmartPointers etc
Michael Van Canneyt
michael at freepascal.org
Thu Jul 28 13:30:52 CEST 2016
On Thu, 28 Jul 2016, Maciej Izak wrote:
> 2016-07-28 12:40 GMT+02:00 Michael Van Canneyt <michael at freepascal.org>:
>> I don't see how you can solve nullable var parameters in native code.
> I'd like to present how TNullable<T> works in my implementation (compilable
> and runable program ;)
Yes, I remember you demonstrate it. But I think there are some caveats.
> === code begin ===
> procedure Test1(var x: Integer);
> x := 1;
Assume a is null before the call to test1:
1. What happens if this procedure is empty, i.e. no write is performed ?
(or it is performed conditionally)
On return, is a null or not ?
2. Assume your variable is null before the call to Test1.
What is the value on entry into Test1 ? i.e. what happens if
if X=0 then
3. How do you detect an actual write ?
4. What happens if Test1 is an external C procedure ?
More information about the fpc-devel