On Sun, 8 Jun 1997 17:03:09 +0200 Frank Heckenbach heckenb@mi.uni-erlangen.de wrote:
Peter Gerwinski wrote:
BTW: Do TV programs actually rely on the zeroing out, or is this just a paranoia initialization?
They do.
Bad style! Well, at least then there should be a BIG warning in the BPCompat objects.pas not to use the library with long strings or other schemata or any initalized fields...
The objects.pas unit in BPCompat does not zero out things. It actually does some "proper" initialisation :-) So, this is a place where I need to add some "!!!" comments to point out the differences with BP.
I don't think it's so bad: Strings are more flexible than Integers. I really like to index a `RessourceFile' (in TV) with Strings ...
As Pierre said: string comparison are less efficient than integer compares, and generally I think *internal* things (i.e. things that must only be read by computers, not by humans) should use integers rather than strings when there's no real need for strings. Resource files, AFAIK, are binary files, anyway, so what good would it be to have some strings scattered in them?
Resource files (at least Windows resource files) can also hold strings in string tables. Most Windows programmers cannot do without these string tables. How would you represent the strings with integers? You need to store the actual strings in the resource file.
A different thing would be textual "resource" files (e.g. like Windoze .ini files): for such things it can be useful to have a string ID (class name), with the compiler switch we discussed, *additionally*, but I think the primary ID should be an integer. (BTW: It might seem that string IDs are "more unique" than integer IDs, but I think the opposite is the case: many programmers will write some "TEdit" class (or "TWindow", "TString", ...), but with integer IDs there are no problems if they choose a unique programmer ID first.)
Would there be a problem if two or more programmers (unknown to each other) just happened to choose the same ID? I am just asking, because I am not sure whether this will affect anything else or not (it may very well not affect anything).
Best regards, The Chief Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant) Author of: Chief's Installer Pro v3.60 for Win16 and Win32. Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ E-mail: laa12@cc.keele.ac.uk