keyongtech


  keyongtech > delphi > 08/2004

 #1  
08-27-04, 07:55 PM
Skybuck Flying
GOD DAMN FUCK !!!

LOOK AT THIS !!!

FUCK FUCK FUCK !

program Project1;

{$APPTYPE CONSOLE}

uses
SysUtils;

var
i : longword;

begin

// [Hint] Project1.dpr(12): FOR or WHILE loop executes zero times - deleted
for i:=0 to 4294967295 do
begin
writeln('hi');
end;
end.

Ok... now I ll be calm and ask a simple question:

Why doesn't this work ?

SIGHhhhhhhhhhhhhhh :)

Like the C example was bad enough... but this totally sucks...

now the loop never gets executed ?!?!?!?!?!?!?!?!

Oh well.
 #2  
08-27-04, 08:41 PM
Rob Kennedy
Skybuck Flying wrote:
> var
> i : longword;
>
> begin
>
> // [Hint] Project1.dpr(12): FOR or WHILE loop executes zero times - deleted
> for i:=0 to 4294967295 do
> begin
> writeln('hi');
> end;
> end.
>
> Ok... now I ll be calm and ask a simple question:


Too late. Please calm down *before* you write your message. Expletives
are not appropriate here.

> Why doesn't this work ?


For the same reason the following will execute 4294967296 times:

var
i: LongWord;

List.Clear;
for i := 0 to List.Count - 1 do ;

You've encountered an edge case regarding loops and unsigned variables.
I consider it a bug. Please report it to Borland on Quality Central.
There may still be time to get it fixed before Delphi 9 ships.
 #3  
08-27-04, 09:47 PM
its me
The reason is so obvious, but nobody will be
prepared to bother to explain it to such a dickhead as yourself!

"Skybuck Flying" <nospam> wrote in message
news:qcp1
[..]
 #4  
08-27-04, 10:19 PM
Skybuck Flying
"Rob Kennedy" <me3> wrote in message
news:84u1
> Skybuck Flying wrote:
> > var
> > i : longword;
> >
> > begin
> >
> > // [Hint] Project1.dpr(12): FOR or WHILE loop executes zero times -

deleted
>
> Too late. Please calm down *before* you write your message. Expletives
> are not appropriate here.
>> For the same reason the following will execute 4294967296 times:

>
> var
> i: LongWord;
>
> List.Clear;
> for i := 0 to List.Count - 1 do ;
>
> You've encountered an edge case regarding loops and unsigned variables.
> I consider it a bug. Please report it to Borland on Quality Central.
> There may still be time to get it fixed before Delphi 9 ships.


Can you report it for me and say 'Credits to Skybuck for finding this bug'
lol :D

And credit yourself for understand or seeing that this is a bug :D hehehehe.

Anyway for now I solved it like this:

for i:=0 to 2147483647 do
begin

end;

etc...

31 bits.

For the current code that's enough since it uses a break to break anyway...

It will never reach 31 or 32 bits anyway ;)

But still.. a bug is a bug :D hehehe.

And one of these days I might need a loop like that for real ! ;)

Skybuck.
 #5  
08-28-04, 12:29 AM
Rob Kennedy
Skybuck Flying wrote:
> Can you report it for me and say 'Credits to Skybuck for finding this bug'
> lol :D


You can do it. It's not that hard. I have faith in you.

I may or may not report it myself, if I can reproduce it tonight. If I
report it, I assure you there will be no mention of you. So, do you want
the credit or not?

> And credit yourself for understand or seeing that this is a bug :D hehehehe.


You saw that it was a bug, too. Borland doesn't need a complete
explanation of *why* the bug occurs; that much will be apparent to
anyone who looks at it. All Borland needs is a demonstration of the bug,
which you already have.

> 31 bits.
>
> For the current code that's enough since it uses a break to break anyway...
>
> It will never reach 31 or 32 bits anyway ;)


You might consider using a "while" loop instead.

When you use a "for" loop, you tell the reader that there is at least
some case in which the loop will run all the way through. A "while" loop
gives you more expressive power about what the loop's termination
conditions are.

> But still.. a bug is a bug :D hehehe.
>
> And one of these days I might need a loop like that for real ! ;)


All the more incentive to report it to Borland. I'm not kidding. Please
report the bug.
 #6  
08-31-04, 07:10 PM
Jamie
Hmm, i really think your problem could be the fact that
Longword is more of an integer, thus you will only get the
- or + range of the count.


Skybuck Flying wrote:
[..]
Similar Threads
Ann: Castalia 2008.1 - Great developers need great tools

[..] I'm excited to announce Castalia 2008.1, the first of Castalia update of 2008. Here's what's new: --New features-- * QuickBar - Fast access to tools that help you...

Were are all these great lisp apps if its such great lang?

dns webserver appserver word processors games dhcp servers operatingsystems I mean its compiled these days eh?

Great Windows 2003 just great

So there goes all my disks Microsoft. Thanks bunch. May in Windows 2000? No IS Windows 2000. Be Honest might start a whole new escapade Microsoft. [..] Also the hardware...

Great but like all great things needs tweaking

Ok bad points first then good points. After installing i had to re-rate about 300 tracks, why did they un-rate??? Yes it works, its works quite fine, but (and this is a big...

OS community can create a great distrobution, but what about a great game?

[..] [..] [..] This thread caught my eye, and I thought I would share it w/ everyone. I would really like to see the open source community get behind this project, and...


All times are GMT. The time now is 02:43 PM. | Privacy Policy