Author |
Message |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Wed Apr 07, 2004 2:10 pm Post maybe stupid Post subject: Code that does nothing forever... |
 |
|
|
|
I was bored... so I coded a few programs or scripts that do nothing forever...
In c++:
int main() {
while (1) { ; }
}
|
In python:
In assembly (for MFA):
.org 0E00h
start: MVI C,0FFh
NOP
DCR C
JZ start
.end |
What languages do you know?
And how do you make then do nothing forever?
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... _________________ It's a shark! Oh my god! Unbelievable! |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Wed Apr 07, 2004 2:41 pm Post maybe stupid Post subject: |
 |
|
|
|
java:
while(true)
or you could do like
for(int i = 1; i > 0; i++) _________________
 |
|
Back to top |
|
 |
-Smong- Guest
Offline
|
Posted: Wed Apr 07, 2004 2:49 pm Post maybe stupid Post subject: |
 |
|
|
|
|
|
Back to top |
|
 |
Gravitron VIE Vet

Age:43 Gender: Joined: Aug 02 2002 Posts: 993 Location: Israel Offline
|
Posted: Wed Apr 07, 2004 2:59 pm Post maybe stupid Post subject: |
 |
|
|
|
Good ol' GWBasic:
$ |
|
Back to top |
|
 |
Dustpuppy Server Help Squatter

Age:40 Gender: Joined: Jan 23 2003 Posts: 215 Location: England Offline
|
Posted: Wed Apr 07, 2004 3:36 pm Post maybe stupid Post subject: |
 |
|
|
|
Befunge:
_________________
 |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Wed Apr 07, 2004 3:43 pm Post maybe stupid Post subject: |
 |
|
|
|
Any other commands that do nothing?
c:
python:
assembly: |
|
Back to top |
|
 |
Dustpuppy Server Help Squatter

Age:40 Gender: Joined: Jan 23 2003 Posts: 215 Location: England Offline
|
Posted: Wed Apr 07, 2004 3:49 pm Post maybe stupid Post subject: |
 |
|
|
|
Does continue (C++) count?  |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Wed Apr 07, 2004 3:59 pm Post maybe stupid Post subject: |
 |
|
|
|
continue actually does something  |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:42 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
|
Back to top |
|
 |
MGG Guest
Offline
|
Posted: Wed Apr 07, 2004 5:27 pm Post maybe stupid Post subject: |
 |
|
|
|
EB FE
 |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: Wed Apr 07, 2004 6:22 pm Post maybe stupid Post subject: |
 |
|
|
|
Every program does something, even NOP increments the program counter
-ASM for the Motorola 6800
0000 BRA (20)
0001 02
-C
Bob:
goto Bob; |
|
Back to top |
|
 |
liito-orava Novice

Gender: Joined: Sep 24 2003 Posts: 41 Offline
|
Posted: Wed Apr 07, 2004 6:25 pm Post maybe stupid Post subject: |
 |
|
|
|
50% Packetloss wrote: |
-C
Bob:
goto Bob; |
That's so ugly. :/ _________________ "Do you hear that? That is the sound of nobody giving a fuck!"
Wolfix> Lesbian transvestites trapped in man's bodies spanking their monkeys to freq 395 |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Wed Apr 07, 2004 6:50 pm Post maybe stupid Post subject: |
 |
|
|
|
50% Packetloss wrote: | Every program does something, even NOP increments the program counter |
Would be painfull if it didn't increase the program counter!
Usually NOP is used to wait 4 cpu clock cycles... which is nothing...
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
 |
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Wed Apr 07, 2004 8:00 pm Post maybe stupid Post subject: |
 |
|
|
|
D1st0rt wrote: | for(int i = 1; i > 0; i++) |
this just runs until the int ceiling value... it stops _________________ Signatures just seem so quaint. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Wed Apr 07, 2004 10:40 pm Post maybe stupid Post subject: |
 |
|
|
|
50% Packetloss wrote: | Every program does something, even NOP increments the program counter |
EB FE doesn't increment the program counter. |
|
Back to top |
|
 |
Qndre's Metaspace Guest
Offline
|
Posted: Thu Apr 08, 2004 3:12 am Post maybe stupid Post subject: |
 |
|
|
|
BASIC:
|
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Thu Apr 08, 2004 7:11 am Post maybe stupid Post subject: |
 |
|
|
|
Mr Ekted wrote: | [..]
EB FE doesn't increment the program counter. |
What's EB FE? |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 08, 2004 11:59 am Post maybe stupid Post subject: |
 |
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | What's EB FE? |
It's Intel machine code for:
label: jmp label |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 08, 2004 1:52 pm Post maybe stupid Post subject: |
 |
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | Usually NOP is used to wait 4 cpu clock cycles...Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
NOP has never taken 4 clock cycles. Pentium it is less than 1, 486 was 1, 386/286/86 was 3. Writing code that assumes a certain number of cpu clocks is very bad. |
|
Back to top |
|
 |
Mine GO BOOM Hunch Hunch What What

Age:42 Gender: Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
|
Posted: Thu Apr 08, 2004 4:23 pm Post maybe stupid Post subject: |
 |
|
|
|
Mr Ekted wrote: | Writing code that assumes a certain number of cpu clocks is very bad. |
I see no problem when playing DigDug. You just have to be a better player. |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Apr 08, 2004 4:49 pm Post maybe stupid Post subject: |
 |
|
|
|
Or, do what normal people do, underclock their CPU. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Thu Apr 08, 2004 4:58 pm Post maybe stupid Post subject: |
 |
|
|
|
Mr Ekted wrote: | [..]
NOP has never taken 4 clock cycles. Pentium it is less than 1, 486 was 1, 386/286/86 was 3. Writing code that assumes a certain number of cpu clocks is very bad. |
We learned assembly at school for programming MFAs (8085). And I'm sure that NOP just waits a few clock cycles. I thought it was 4, I have to look it up in my book.
EDIT: Yeah, my books says: NOP / No operation / 1 byte / 4 clock cycles
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
 |
pixelsoft Seasoned Helper

Age:38 Gender: Joined: Apr 15 2003 Posts: 154 Location: Vienna Offline
|
Posted: Sun Apr 11, 2004 5:59 am Post maybe stupid Post subject: |
 |
|
|
|
php:
_________________ i don't have anything important to say |
|
Back to top |
|
 |
Sercit 99.5% Optimistic

Age:41 Gender: Joined: Sep 12 2003 Posts: 352 Offline
|
Posted: Sun Apr 11, 2004 6:25 am Post maybe stupid Post subject: |
 |
|
|
|
You know your a coder with too much time on your hands, and no porn at the ready, when you type up codes that do nothing, forever.  _________________ Signature. |
|
Back to top |
|
 |
|