Article

From:
To:
Philippe Ranger
Subject:
Re: Cardinality of a set
Newsgroup:
borland.public.delphi.objectpascal

Re: Cardinality of a set

Philippe, You are are quite correct in seeing a problem with
"ord(high(set))+1".  On a related topic, that I have never seen
discussed here, is the problem of using other people's definition of
enumerated types in const statements like ...

const FieldTypeNames: array [TFieldType] of string[4] = ('Unk', 'A', .... ,'Guid');
I have twice created a maintenance problem with the above kind of code, which occured when Borland extended the types. That problem could have been avoided by "subtyping" the TFieldType like in the following ...
type TFieldTypeX = (ftUnknown .. ftGuid); const FieldTypeNames: array [TFieldTypeX] of string[3] = ('Unk', 'A', .... ,'Guid');
But what is a good way to minimize the effect of adding a member in the middle of the range?
Thanks for pointing out my error, John H
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Tue, 26 Nov 2024 11:36:44 UTC
Copyright © 2009-2024
HREF Tools Corp.