Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Code that does nothing forever...
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  RC Movies Post :: Post One more post  View next topic  
Author Message
1stStrike
Cute like a kitty


Joined: Dec 28 2002
Posts: 427
Offline

PostPosted: Sun Apr 11, 2004 9:10 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Programming is one of the most boring, annoying and pain in the ass things out there. I get no joy whatsoever from it and hate every class I'm forced to go to.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Apr 11, 2004 10:17 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Awww 1st, you're no fun!
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
ExplodyThingy
Server Help Squatter


Age:38
Gender:Gender:Male
Joined: Dec 15 2002
Posts: 528
Location: Washington DC
Offline

PostPosted: Sun Apr 11, 2004 1:04 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

while(first.patrypooper()) { ; }
_________________
There are no stupid question, but there are many inquisitive idiots.
Loot

Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Apr 11, 2004 2:27 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dustpuppy
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Jan 23 2003
Posts: 215
Location: England
Offline

PostPosted: Sun Apr 11, 2004 3:33 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Code: Show/Hide

int i = 3324;

i = 15;
i /= 3;
i *= 4;
i /= 10;
i--;

while (i == 1)
{
   char moo[20];
   char *a;
   strcpy(moo, "Mooo!");
   a = &*moo;
   a += i;
   itoa(*a, moo, 10);
   a = &*moo;
   for (int x=0;x<=1;x++)
      a++;

   i = atoi(a);
}   

_________________
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:38
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Thu Apr 15, 2004 1:50 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Helicon wrote:
[..]

this just runs until the int ceiling value... it stops


for ( ; ; )

icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Apr 15, 2004 3:18 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

^_^ ugg
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Apr 15, 2004 4:26 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Of course, most of the examples posted so far would use 100% CPU, so they do far from nothing. icon_smile.gif
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Apr 15, 2004 4:48 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

But technicly, even code that is doing nothing is doing something. It's doing nothing, and nothing is something.

Everything is something, even nothing.

And if you think I have a lot of things (like nothing, everything, and something) in this post, you have another thing coming.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Apr 15, 2004 6:01 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Thing count: 13 icon_biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Thu Apr 15, 2004 8:10 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
But technicly, even code that is doing nothing is doing something. It's doing nothing, and nothing is something.

Everything is something, even nothing.

And if you think I have a lot of things (like nothing, everything, and something) in this post, you have another thing coming.


Nothing can have no properties, cuz no porperty is a property and nothing is something! That's some weired stuff...

Anyways, back to topic...
@ekted:
Which codes of the ones posted does not use 100% of the cpu?

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
_________________
It's a shark! Oh my god! Unbelievable!
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Apr 15, 2004 9:07 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

As far as the "doing nothing forever" topic, only mine uses 0% CPU:

WaitForSingleEvent();

as long as the event never triggers.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Apr 15, 2004 10:17 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

It's impossible that a loop can use 0% CPU... it has to be doing something somewhere...

Err and interesting title, MGB icon_eek.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Apr 16, 2004 12:33 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

WaitForSingleEvent() is a Windows function that suspends your thread until the specified event occurs. It does not run. It does not execute any instructions. It does not take any CPU.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Apr 16, 2004 8:14 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Wacky. icon_razz.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Grelminar
Creator of Asss


Joined: Feb 26 2003
Posts: 378
Offline

PostPosted: Mon Apr 19, 2004 4:40 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

The purest infinite loop uses no looping constructs or explicit recursion, only the idea of self-application:

((lambda (x) (x x)) (lambda (x) (x x)))

And this one makes your head explode when you try to figure out how it works:

((call/cc (lambda (x) (x x))) (call/cc (lambda (x) (x x))))

Finally, if you're looking for something to make your CPU actually do nothing, as opposed to looping infinitely, the best method is to remove the power cord from the back of your box. It saves more energy than just putting your thread to sleep, too!
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Maucaub
Newbie


Joined: Apr 15 2004
Posts: 12
Offline

PostPosted: Sat Apr 24, 2004 12:52 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Grelminar wrote:
((call/cc (lambda (x) (x x))) (call/cc (lambda (x) (x x))))

Ugh, that's just .... evil ....

And just to be anal for those who care about such things, a NOP truly does nothing while EB FE actually does alter the program counter. Instructions are pre-incremented by the hardware in the CPU, hence a NOP does nothing but wait for the next instruction while EB FE substracts 2 from the instruction pointer (that's what the FE part is for!). Of course, all of these details become blurred when considering modern superscalar pipelined architectures with dynamic scheduling and branch prediction, anyway ...
Back to top
View users profile Send private message Add User to Ignore List Send email
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sat Apr 24, 2004 1:10 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Well, the RESULT of a NOP is that the PC in incremented. The RESULT of EB FE is that the PC does not change.
Back to top
View users profile Send private message Add User to Ignore List
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Sat Apr 24, 2004 10:15 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

oh I just thought of how to do it on a TI-83

Lbl A
Goto A

or you could just do

While(1)
End
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sat Apr 24, 2004 10:43 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

If the PC does not change with EB FE how do you break out of it? Are you supposed to put stuff between the EB and FE?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Sat Apr 24, 2004 1:38 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

What is a EB FE anyway? A Wait for Interupt?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Sat Apr 24, 2004 1:41 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Why would
Code: Show/Hide
lbl: jmp lbl

ever inc the PC?
There's no sense in it... I think... icon_wink.gif

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
Back to top
View users profile Send private message Add User to Ignore List
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Sat Apr 24, 2004 1:43 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

50% Packetloss wrote:
What is a EB FE anyway? A Wait for Interupt?


Mr Ekted wrote:
It's Intel machine code for:

label: jmp label
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sat Apr 24, 2004 3:29 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote:
Why would
Code: Show/Hide
lbl: jmp lbl

ever inc the PC?
There's no sense in it... I think... icon_wink.gif
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....


Well, internally what happens is once an instruction is loaded--in this case 2 bytes--the program counter (called EIP in Intel) is advanced 2 bytes. Then the instruction is executed. This instruction basically says EIP = EIP - 2. So the actual increment and decrement does occur in the micro-code.

To answer the other question: If you indeed had EB FE in your program and the CPU "found" it, your program would go 100% CPU and "lock up", requiring a kill. It is not a naturally occurring instruction, unless you wrote some C code like:

Code: Show/Hide
Here: goto Here;
Back to top
View users profile Send private message Add User to Ignore List
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Sat Apr 24, 2004 4:30 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Mr Ekted wrote:
[..]Well, internally what happens is once an instruction is loaded--in this case 2 bytes--the program counter (called EIP in Intel) is advanced 2 bytes. Then the instruction is executed. This instruction basically says EIP = EIP - 2. So the actual increment and decrement does occur in the micro-code.


Yeah, acutally all that "jmp lbl" does is to decrement the eip to the point where the lbl is...
Which is, in this case, the same as it has been before jmp.

I'm going to write my A-level exam on monday, and a part of it will be assembler for 8085. Interupt aso...

Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole....
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 253 page(s) served in previous 5 minutes.

phpBB Created this page in 0.731008 seconds : 49 queries executed (76.7%): GZIP compression disabled