Von: Michael Van Canneyt mich...@freepascal.org:
Like I said, we should not have named it enums. They are not enums.
They're a hack to support some C construct in a type-safe way.
No more, no less.
IBTD.
-- 8 --
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Unchecked_Conversion;
procedure
On Fri, Nov 6, 2009 at 05:51, Vinzent Höfler
jellyfish.softw...@gmx.net wrote:
Von: Michael Van Canneyt mich...@freepascal.org:
Like I said, we should not have named it enums. They are not enums.
They're a hack to support some C construct in a type-safe way.
No more, no less.
IBTD.
[skip
Alexander Klenin schrieb:
The best Succ(X) algorithm I can think of that works correctly on
sparse enums is O(log enum_size).
It depends how much memory one wastes ;)
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
Alexander Klenin wrote:
Yet another bug:
---
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
This is caused by the problem in the for-to loop:
for ch := Low(T) to High(T) do
WriteLn(ch)
How should I solve the problem in the for-in loop?
I tried the next way:
Paul Ishenin schrieb:
Alexander Klenin wrote:
Yet another bug:
---
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
This is caused by the problem in the for-to loop:
for ch := Low(T) to High(T) do
WriteLn(ch)
How should I solve the problem in the
On Wed, Nov 4, 2009 at 22:36, Paul Ishenin webpi...@mail.ru wrote:
Alexander Klenin wrote:
Yet another bug:
---
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
This is caused by the problem in the for-to loop:
for ch := Low(T) to High(T) do
WriteLn(ch)
Florian Klaempfl wrote:
You can use the rtti generated for those enums.
For me it is still the question if for-to loop should work:
for ch := Low(T) to High(T) do
WriteLn(ch)
Best regards,
Paul Ishenin.
___
fpc-devel maillist -
In our previous episode, Paul Ishenin said:
Yet another bug:
---
{$apptype console}
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
CodeGear Delphi for Win32 compiler version 20.0
Copyright (c) 1983,2008 CodeGear
testx.dpr(6) Error: E2029 '(' expected
Marco van de Voort schreef:
In our previous episode, Paul Ishenin said:
Yet another bug:
---
{$apptype console}
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
CodeGear Delphi for Win32 compiler version 20.0
Copyright (c) 1983,2008 CodeGear
testx.dpr(6) Error:
In our previous episode, Micha Nelissen said:
Does it work on not sparse enums?
Those are dense enums? :-)
true enums.
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
Vincent Snijders wrote:
Since I suspected that D2009 doesn't work on sparse enums, I tried,
and the
above is the result.
Does it work on not sparse enums?
Delphi compiler does not support for-in loop for types (enums, integer,
...). This is fpc extension :)
Best regards,
Paul Ishenin.
In our previous episode, Vincent Snijders said:
yy end.
CodeGear Delphi for Win32 compiler version 20.0
Copyright (c) 1983,2008 CodeGear
testx.dpr(6) Error: E2029 '(' expected but 'DO' found
testx.dpr(7) Error: E2430 for-in statement cannot operate on collection
type 'T'
In our previous episode, Paul Ishenin said:
Since I suspected that D2009 doesn't work on sparse enums, I tried,
and the
above is the result.
Does it work on not sparse enums?
Delphi compiler does not support for-in loop for types (enums, integer,
...). This is fpc extension :)
Do
Marco van de Voort wrote:
Do you have unit tests for multidimensional arrays. I saw quite funky
examples (involving dummy variables) in the D2009 help for that.
No. I know delphi allows to enumerate multidimensional arrays but fpc
traverses only the first dimension.
Best regards,
Paul
In our previous episode, Alexander Klenin said:
? WriteLn(ch);
? inc(ch);
But it fails the same way.
ch := succ(ch);
OTOH, I am not sure -- obviously either Succ or Inc is buggy, but which one?
Maybe runtime instead of compile-time error is actually correct?
Sparse enums are simply
Marco van de Voort wrote:
Sparse enums are simply a kludge. They were needed because they exist in the
Windows API, and afaik for that only. IOW for easy translation of Windows types.
They were added to Delphi in version 6. I though they added them to
support Qt and the CLX, which relied
In our previous episode, Matt Emson said:
Sparse enums are simply a kludge. They were needed because they exist in
the Windows API, and afaik for that only. IOW for easy translation of
Windows types.
They were added to Delphi in version 6. I though they added them to
support Qt and
Paul Ishenin wrote:
Marco van de Voort wrote:
Do you have unit tests for multidimensional arrays. I saw quite funky
examples (involving dummy variables) in the D2009 help for that.
No. I know delphi allows to enumerate multidimensional arrays but fpc
traverses only the first dimension.
To
Matt Emson memson.li...@googlemail.com:
The problem I always had with Pascal supporting them was that a Pascal
enum was designed to represents the position in a sequence and not
necessarily an underlying integral value - where as a sparse enum is
simply a grouping for a bunch of numerical
Another minor problem:
--
begin
for ch in S do Writeln(ch);
end.
--
Results in:
t.pp(2,10) Error: Identifier not found ch
t.pp(2,15) Error: Identifier not found S
t.pp(2,28) Error: Identifier not found ch
t.pp(2,29) Error: Can not find an enumerator for the type erroneous type
IMHO the last
Yet another bug:
---
type T = (a1, b1=5);
var
ch: T;
begin
for ch in T do Writeln(ch);
end.
---
This leads to runtime error.
Note that
---
type T = (a1, b1=5);
begin
Writeln(Succ(a1));
end.
---
leads to compile-time error
(although I think it should work, but that is a separate topic).
Another bug:
---
var
ch: Char;
begin
for ch in [] do Writeln(ch);
end.
---
= AV in compiler
--
Alexander S. Klenin
___
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
22 matches
Mail list logo