I've managed to give you an example of reproducing my "most trouble" making problem and I really need your help:
Giving four units:
This causes the "routine definition does not match previous declaration" error in the "TListbox"-GetTextString method. But why and how I can avoid this ???
This was a known bug in 20030507 which was fixed in the latest release. (Search for nick2.pas in the archives if you need more information.)
If you can't or don't want to upgrade, a work-around is not use `String' to mean `String (255)', but declare an explicit type for it (which I'd generally recommend, anyway). The bug occurs only with that type.
Another silly problem is that in the unit aTest the type of MyInt depends on the order of the units ua and ub in the uses-part.
AFAIK, that's BP compatible, since both units declare the same identifier with different meanings. Since units are a BP (and UCSD Pascal) feature, we try to emulate this behaviour in general. (Extended Pascal modules don't allow this.)
IMHO the most we could do is an (optional) warning when importing the same identifier from several units. I think it could be useful -- the default should be off, of course, but perhaps `-Wall' should turn it on. Waldek, since you're working in that area, would this be easy to add?
Frank
Frank Heckenbach wrote:
IMHO the most we could do is an (optional) warning when importing the same identifier from several units. I think it could be useful -- the default should be off, of course, but perhaps `-Wall' should turn it on. Waldek, since you're working in that area, would this be easy to add?
It does not look hard, but currently System module redefines a symbol from GPC module. I think we need first a method to avoid warning if redefinition is intentional (at least if `-Wall' activates such warning).
Waldek Hebisch wrote:
Frank Heckenbach wrote:
IMHO the most we could do is an (optional) warning when importing the same identifier from several units. I think it could be useful -- the default should be off, of course, but perhaps `-Wall' should turn it on. Waldek, since you're working in that area, would this be easy to add?
It does not look hard, but currently System module redefines a symbol from GPC module. I think we need first a method to avoid warning if redefinition is intentional (at least if `-Wall' activates such warning).
Well, `System' is for "hardcore" BP compatibility, and such projects won't probably even think of using `-Wall'. ;-)
Quite a weak argument, I know, but anyway, they can always turn off this option (with a `{$local W no-duplicate-import}' or so, if they want it otherwise). If that's the only case where we expect it to happen, I wouldn't mind so much.
Frank