Re: [fpc-devel] enums and integer auto conversion

2012-09-11 Thread Marco van de Voort
In our previous episode, Dani?l Mantione said: > Sets, are a bit more complicated: Their binary layout is defined in > Borland documentation, but this one of the few issues were FPC didn't > follow Borland. FPC has smallsets, up to 32 items and longsets, up to 256 > items. That's outdated, runn

Re: [fpc-devel] enums and integer auto conversion

2012-09-11 Thread Jonas Maebe
On 11 Sep 2012, at 06:18, Alexander Klenin wrote: > How about packed sets? Do they have well-defined memory layout? If > not, then maybe they should? Set packing only influences the number of bytes occupied by sets, not their internal layout. And I don't think that should change, because they

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Daniël Mantione
Op Tue, 11 Sep 2012, schreef Alexander Klenin: On Tue, Sep 11, 2012 at 8:03 AM, Jonas Maebe wrote: If you want to do that, you need to add a layer in between that converts the sets into integer bitmasks in a reliable, portable and future-proof way. How about packed sets? Do they have wel

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Alexander Klenin
On Tue, Sep 11, 2012 at 8:03 AM, Jonas Maebe wrote: > > If you want to do that, you need to add a layer in between that converts the > sets into integer bitmasks in a reliable, portable and future-proof way. > How about packed sets? Do they have well-defined memory layout? If not, then maybe the

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Jonas Maebe
On 10 Sep 2012, at 23:42, Daniël Mantione wrote: > Op Mon, 10 Sep 2012, schreef Jonas Maebe: > >> You can explicitly define the ordinal values of enumerations if you depend >> on that sort of stuff (which afaik the Qt units in fact do). > > That's a rewriting of history, as we invented that fe

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Daniël Mantione
Op Mon, 10 Sep 2012, schreef Jonas Maebe: On 10 Sep 2012, at 23:12, Daniël Mantione wrote: Op Mon, 10 Sep 2012, schreef Jonas Maebe: If you want to do that, you need to add a layer in between that converts the sets into integer bitmasks in a reliable, portable and future-proof way. Yes

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Jonas Maebe
On 10 Sep 2012, at 23:12, Daniël Mantione wrote: > Op Mon, 10 Sep 2012, schreef Jonas Maebe: > >> If you want to do that, you need to add a layer in between that converts the >> sets into integer bitmasks in a reliable, portable and future-proof way. > > Yes! Let's also convert integers to enu

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Daniël Mantione
Op Mon, 10 Sep 2012, schreef Jonas Maebe: If you want to do that, you need to add a layer in between that converts the sets into integer bitmasks in a reliable, portable and future-proof way. Yes! Let's also convert integers to enums with a case statement rather than typecast, just in case

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Jonas Maebe
On 10 Sep 2012, at 22:58, Daniël Mantione wrote: > Op Mon, 10 Sep 2012, schreef Jonas Maebe: > >> No, sets are an opaque data type. Their internal format is undefined. > > I knew you would answer to that :) While, I disagree that a set is opaque, > but, we can skip that discussion. What's goin

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Daniël Mantione
Op Mon, 10 Sep 2012, schreef Jonas Maebe: On 10 Sep 2012, at 22:06, Daniël Mantione wrote: On Monday 10 September 2012 20:18:52 Vincent Snijders wrote: If it is the combination of enum, then the type of the parameter is set of enum. Ahum, I am talking about passing combinations of enums v

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Jonas Maebe
On 10 Sep 2012, at 20:03, Den Jean wrote: > As described in > http://bugs.freepascal.org/view.php?id=22797 > > fpc 2.7.1 does not allow anymore to pass an enum > to a function expecting integers. This has never been allowed. The only thing that was allowed was defining an enum as a default va

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Jonas Maebe
On 10 Sep 2012, at 22:06, Daniël Mantione wrote: >> On Monday 10 September 2012 20:18:52 Vincent Snijders wrote: >>> If it is the combination of enum, then the type of the parameter is set of >>> enum. >> Ahum, I am talking about passing combinations of enums values >> (usually bitmasks, assigned

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Marco van de Voort
In our previous episode, Dani?l Mantione said: > > On Monday 10 September 2012 20:18:52 Vincent Snijders wrote: > >> If it is the combination of enum, then the type of the parameter is set of > >> enum. > > Ahum, I am talking about passing combinations of enums values > > (usually bitmasks, assigne

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Daniël Mantione
Op Mon, 10 Sep 2012, schreef Den Jean: On Monday 10 September 2012 20:18:52 Vincent Snijders wrote: If it is the combination of enum, then the type of the parameter is set of enum. Ahum, I am talking about passing combinations of enums values (usually bitmasks, assigned enums, some assigned

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Den Jean
On Monday 10 September 2012 20:18:52 Vincent Snijders wrote: > If it is the combination of enum, then the type of the parameter is set of > enum. Ahum, I am talking about passing combinations of enums values (usually bitmasks, assigned enums, some assigned enums are already combinations of other) t

Re: [fpc-devel] enums and integer auto conversion

2012-09-10 Thread Vincent Snijders
2012/9/10 Den Jean : > Hi, > > As described in > http://bugs.freepascal.org/view.php?id=22797 > > fpc 2.7.1 does not allow anymore to pass an enum > to a function expecting integers. > > Note that there has always been a > {$MINENUMSIZE 4} in qt4.pas > > Is this intended behaviour ? I really hope i

[fpc-devel] enums and integer auto conversion

2012-09-10 Thread Den Jean
Hi, As described in http://bugs.freepascal.org/view.php?id=22797 fpc 2.7.1 does not allow anymore to pass an enum to a function expecting integers. Note that there has always been a {$MINENUMSIZE 4} in qt4.pas Is this intended behaviour ? I really hope it is not. I cannot define the type of t