Delphi dowsn't allow sets with ordinal values larger than 255 too:
That's incorrect.
.
Sets are restricted to a maximum of 256 members, but the ordinal values
of the members can be higher.
As I've already posted: sample code below not compile in any Delphi version. You
can try it yourself.
ty
Alexey Barkovoy wrote:
> Delphi dowsn't allow sets with ordinal values larger than 255 too:
That's incorrect.
> Borland Delphi Version 13.0 Copyright (c) 1983,99 Inprise Corporation
> 1.pas(2) Error: Sets may have at most 256 elements
Sets are restricted to a maximum of 256 members, but the o
{$mode delphi}
type aenum=510..517;
aset = set of aenum;
begin
Writeln(sizeof(aset));
end.
xbla.pp(5,25) Error: illegal type declaration of set elements
xbla.pp(10,4) Fatal: There were 1 errors compiling module, stopping
Delphi dowsn't allow sets with ordinal values larger than 255 too:
Borlan
> > Older Delphi (and TP?) versions implemented sets of subranges (e.g. set
> > of 510..515) by "stripping" unused bytes in front of the set. The lowest
> > bit in a set variable always had an ordinal value of 2^n, and above set
> > would occupy 2 bytes, equaling an set of (504..519). In newer Delp
> Older Delphi (and TP?) versions implemented sets of subranges (e.g. set
> of 510..515) by "stripping" unused bytes in front of the set. The lowest
> bit in a set variable always had an ordinal value of 2^n, and above set
> would occupy 2 bytes, equaling an set of (504..519). In newer Delphi
> ver
>
> Can somebody enlighten me, what code exactly fails in D6?
> What extension does FPC have, that Delphi doesn't have?
>
> And what "iteration" is desired? I'd use: For Low(x) To High(x)...
>
> Let me add some more notes, regarding Delphi compatibility:
>
> Older Delphi (and TP?) versions imple
Marco van de Voort wrote:
>
> > > TShiftState is defined as TShiftState = set of (...);
> > >
> > > How can I iterate through the enums? If not, can we split and add an
> > > enum:
> > >
> > > TShiftStateEnum = (...)
> > > TShiftState = set of TShiftStateEnum;
> > >
> > > ?
> >
> > Of course that
> Jose Manuel wrote:
>
> >I think sets are sets and enumerated types are enumerated types,
> and Pascal
> >is Pascal-
> >
> >
> Ok, but in pascal the elements in a set can only be of ordered
> type anyway.
Yes, of course. Maybe I haven't explained myself. Indeed, and you are quite
right you'got to
Jose Manuel wrote:
Well, sets are by definition a kind of bag. No enumeration or any kind of
order are suited to sets.
Can be handy, I agree, under certain situations, but then we are getting
back to C.
I think sets are sets and enumerated types are enumerated types, and Pascal
is Pascal-
Ok, bu
> > >
> > > > TShiftStateEnum = (...)
> > > > TShiftState = set of TShiftStateEnum;
> > > >
> > > > ?
> > >
> > > Of course that is possible. It requires some imagination though (and
> > > a feel for obfuscated Pascal)
> >
> >
> > The example fails in Delphi 6 btw, but works in FPC :-)
>
> Intere
> [EMAIL PROTECTED] (Marco van de Voort) wrote:
> >
> > The example fails in Delphi 6 btw, but works in FPC :-)
>
> Interesting :)
Yeah, D2005 for IN syntax is also useful for this (if it operates on sets)
> But in this case: why not simply add one line to classes.pp?
That is not as much fun!
On Thursday 17 February 2005 07:37, Marco van de Voort wrote:
> type myset = set of ( a1,a2,a3,a4,a5,a6);
>
> // workaround types
> const
> beginmyset=ord(low(myset));
> endmyset=ord(high(myset));
> type
> uglyenum = beginmyset..endmyset;
> uglyset= set of uglyenum;
>
> var b :
On Thu, 17 Feb 2005 08:58:01 +0100 (CET)
[EMAIL PROTECTED] (Marco van de Voort) wrote:
> > > TShiftState is defined as TShiftState = set of (...);
> > >
> > > How can I iterate through the enums? If not, can we split and add
> > > an enum:
> > >
> > > TShiftStateEnum = (...)
> > > TShiftState =
> > TShiftState is defined as TShiftState = set of (...);
> >
> > How can I iterate through the enums? If not, can we split and add an
> > enum:
> >
> > TShiftStateEnum = (...)
> > TShiftState = set of TShiftStateEnum;
> >
> > ?
>
> Of course that is possible. It requires some imagination thoug
> TShiftState is defined as TShiftState = set of (...);
>
> How can I iterate through the enums? If not, can we split and add an
> enum:
>
> TShiftStateEnum = (...)
> TShiftState = set of TShiftStateEnum;
>
> ?
Of course that is possible. It requires some imagination though (and a feel
for obfu
TShiftState is defined as TShiftState = set of (...);
How can I iterate through the enums? If not, can we split and add an
enum:
TShiftStateEnum = (...)
TShiftState = set of TShiftStateEnum;
?
Mattias
___
fpc-devel maillist - fpc-devel@lists.free
16 matches
Mail list logo