Felipe Monteiro de Carvalho wrote:

Free is how you release the memory allocated for a object. Free calls
Destroy. Never call Destroy manually. When you implement the
destructor you always implement Destroy, never change Free.

A number of years ago, Matthew Jones's wife looked over his shoulder and caught him using Create and Destroy. "Bit violent, isn't it?" When he told the story somebody else pointed out that he should be using Create and Free, I find this anecdote makes it easy to remember.

Nil is not a routine, it is a value, it means that the object is
empty, it does not exist / is not allocated. Nil in existing
implementations that I know is represented by the value zero.

I've once seen a compiler using a non-zero value, I think it was the first Logitech protected-mode Modula-2 and it used ffff:0000. Apart from that I think that C specifies that nil has a bit pattern of all zeros, and anything with even the slightest interest in compatibility sticks to this as a convention.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to