Difference between revisions of "User talk:Chronos"

From Free Pascal wiki
Jump to navigationJump to search
 
Line 1: Line 1:
 
Hmm, the fact tha a pointer can be nil does not mean that a pointer is nullable. A pointer points to a memory adress. Setting a pointer to nil, simply points it to memory adress 0. --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 18:44, 12 November 2018 (CET)
 
Hmm, the fact tha a pointer can be nil does not mean that a pointer is nullable. A pointer points to a memory adress. Setting a pointer to nil, simply points it to memory adress 0. --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 18:44, 12 November 2018 (CET)
:This is matter of difference between a concept and an implementation. Pointer type is nullable because it can be set to have "no value" which is represented with nil in Delphi. Nil is implemented like const nil = Pointer(0) which is simply zero address. But how would you implement it differently to be the most efficient for computation? And also nil is the same concept as null in C# or NULL in C/C++. And null is used in C# for nullable types. In Delphi there is also Assigned function which can be used for testing variable for nil value, but it would be complicated to implement same function for generic Nullable record.
+
:This is matter of difference between a concept and an implementation. Pointer type is nullable because it can be set to have "no value" which is represented with nil in Delphi. Nil is implemented like const nil = Pointer(0) which is simply zero address. But how would you implement it differently to be the most efficient for computation? And also nil is the same concept as null in C# or NULL in C/C++. And null is used in C# for nullable types. In Delphi there is also Assigned function which can be used for testing variable for nil value, but it would be complicated to implement same function for generic Nullable record.--[[User:Chronos|Chronos]] ([[User talk:Chronos|talk]]) 09:00, 13 November 2018 (CET)

Latest revision as of 09:00, 13 November 2018

Hmm, the fact tha a pointer can be nil does not mean that a pointer is nullable. A pointer points to a memory adress. Setting a pointer to nil, simply points it to memory adress 0. --Bart (talk) 18:44, 12 November 2018 (CET)

This is matter of difference between a concept and an implementation. Pointer type is nullable because it can be set to have "no value" which is represented with nil in Delphi. Nil is implemented like const nil = Pointer(0) which is simply zero address. But how would you implement it differently to be the most efficient for computation? And also nil is the same concept as null in C# or NULL in C/C++. And null is used in C# for nullable types. In Delphi there is also Assigned function which can be used for testing variable for nil value, but it would be complicated to implement same function for generic Nullable record.--Chronos (talk) 09:00, 13 November 2018 (CET)