I am trying to write code that will compile cleanly in current and future versions of FPC (in mode Delphi) and Delphi on 32- and 64-bit platforms. I need to store strings and their floating point rankings in a list and I was advised to use the single type and store them in the TStringList.Objects list, using a cast to store and retreive the values.
SL := TstringList.Create;
rank := 0.95;
title := 'This is a string';
SL.AddObject(title,pointer(rank));This feels unsafe.. I'd hate to have to come back later to debug why the ranks have become completely garbled on a new platform or version.
Should I convert ranks to an integer (slightly awkward)? Or just create a trivial class to hold ranks as objects (seems like overkill)? Or...?
-Alan
