Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-09

Operator overloading

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

Is there any way of overloading the ^ (dereference) operator for a user-defined type?

I'm looking at a simple Prolog interpreter written in TP3, i.e. 16-bit code, and I think I might even have a fun use for it.

Obviously it's chock-full of segment:offset pointers but if ^ could be overloaded it might make it easier to implement or at least to debug a local heap.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Mark Morgan Lloyd
to Jonas Maebe
Jonas Maebe wrote 6 lines
On 19 Sep 2009, at 22:21, Mark Morgan Lloyd wrote: > Is there any way of overloading the ^ (dereference) operator for a > user-defined type? No, it isn't.

Shucks :-) I remember that JPI v1 had what they called "virtual pointers" which specified a dereference function and could be useful, OTOH with today's flat memory and improved OSes there's probably other ways of doing it.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]