The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,573 other followers

Archive for May 30th, 2012

Pointers to value and to reference types (was: delphi – Why does TValue.Make require a pointer to an object reference? – Stack Overflow)

Posted by jpluimers on 2012/05/30

Delphi seemingly makes the distinction between reference and value types disappear, especially because it hides the ^derefererncing operator for most usages:

  • there is no ^ dereferencing operator when following “class” type object instances, “interface” references and “object” type object instances, strings, open arrays and dynamic arrays: the dereferencing is implicit
  • usually you do not need the ^ dereferencing operator when

Rudy Velthuis wrote a great article on pointers in general. Though it was in the Delphi 2009 timeframe, almost everything is very valid. A few things are missing, some additions are below.

I’m not going into deep detail here right now, just a few notes to get people interested going.

Hopefully I will some time in the future to either go into more detail, or point to articles that do.

  1. “object” style object instances.
    Those have been deprecated since Delphi 1 (which introduced “class” style objects), but there are still libraries that use them, and (almost unbeleivable): they are supported in Delphi x64
  2. anonymous method references
  3. Events (method references) aka the “procedure … of object”/”function … of object”
    are implemented using the underlying TMethod type from the System unit
    always use the “Assigned” method to check if both the Data and Method field are non-nil

Even with those additions to Rudy’s list, I’m not 100% sure everything is complete now (:


via: delphi – Why does TValue.Make require a pointer to an object reference? – Stack Overflow.

Posted in Delphi, Development, Software Development | 4 Comments »

%d bloggers like this: