Does this still works in XE6?

Does this still works in XE6?
The online help (http://docwiki.embarcadero.com/RADStudio/XE6/en/Parameters_%28Delphi%29) says "With an out parameter, however, the initial value of the referenced variable is discarded by the routine it is passed to" but in Delphi XE i dont get an EAV which i should get, if it is implemented in the way the help says...
http://pastebin.com/cypPefUd

Comments

  1. To expand. For managed types (strings, dynarrays etc), the compiler has to nil these before passing them, due to the way these are allocated. But that's an implementation detail, and specifically it doesn't have to do this for object references or other non-managed types.

    The issue is similar if you have a function returning a string vs one returning a non-managed type.

    ReplyDelete
  2. Imo the compiler should raise a warning about the use of an uninitialized value here.

    ReplyDelete
  3. Simon Stuart Yap, I would even use no special parameter semantic. I found this while looking in our git history from a coworker. If i had to use something, i would use const, so everybody knows that the object, which is inserted, is still the object which is returned.

    ReplyDelete

Post a Comment