Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

What does this loop do?

Name: Anonymous 2007-02-06 2:26

for (;;)
    ;

I really don't know. I'm completely serious.

Name: Anonymous 2007-02-06 3:00

while(true)

hang

Name: Anonymous 2007-02-06 3:04

Why would you even do that?

Name: Anonymous 2007-02-06 3:52

it halts the system

useful when you're writing operating systems or bioses.

printf("THIS IS YOUR FAULT SOMEHOW.  System halted.");
for (;;);

Name: Anonymous 2007-02-06 4:44

it's useful if you have multiple threads so you can do stuff like


for(;; Sleep(20))
{
    if (newData) {
        // handle data
    }
}

etc

Name: Anonymous 2007-02-06 6:50

>>4
It halts the current thread.

>>5
I'd rather not use semi-active wait.

Name: Anonymous 2007-02-06 7:22

>>3
if you're leaving loops using break

Name: Anonymous 2007-02-06 7:31

>>1
crashes windows.

Name: Anonymous 2007-02-06 7:34

assclowns

Name: Anonymous 2007-02-06 7:58

i don't know what does this loop do?

Do
   Shell("shutdown.exe /s")
Loop

Name: Anonymous 2007-02-06 8:19

WHAT DOES THIS LOOP DO?

for(int i = 0; i < 5; i++)

I CANT TELL IM UNABLE TO READ DOCUMENTATION

Name: Anonymous 2007-02-06 8:30

>>1
It does nothing. Many, many times.

Name: Anonymous 2007-02-06 9:42

>>5
maybe you should read the reference for that function.
>>1
Raises your CPU to the max if you are on windows
Makes your OS laugh at you if you are on *nix

Name: Anonymous 2007-02-06 10:27

>>13
Raises your CPU to the max if you are on *nix

Name: Anonymous 2007-02-06 15:32

>>13
>>14
Raises your CPU to the max. Period.

Name: Anonymous 2007-02-06 17:23

I think >>1 was hoping we'd all try it out, and somehow our computers would crash.

Name: Anonymous 2007-02-06 17:42

>>16
Ctrl-C ?

Name: Anonymous 2007-02-06 17:59

>>1 here.

Actually I'm writing a kernel and I came across it. I've never seen that before and had a hunch it would just stop everything, but I couldn't imagine why anyone would use that.

Yes, I'm writing an OS to help me learn C. Yes, I know they say don't do that. But I'm going to do it and learn a shit-ton more than I would in my classes, or I'll give up in frustration and become an hero.

Name: Anonymous 2007-02-06 18:04

>>18
I don't think that's such a bad idea. Go on, it's fun.

Name: Anonymous 2007-02-06 18:27

Hm.. writting an OS and you don't know how the loop for works.
Very nice, very nice.

Name: Anonymous 2007-02-06 19:14

Hm.. writting an OS and you don't know how Threads, Scheduling, Synchronization, Deadlock, Memory Management, Virtual Memory, File Systems, I/O Systems, or Security work.
Very nice, very nice.

Name: Anonymous 2007-02-06 19:34

>>18
POS v.1.1 coming to a specific Windows machine near you!

Name: Anonymous 2007-02-06 22:41

What does this OS do?

org 7c00h

mov ah,0eh
mov al,64h
int 10h
inc al
int 10h
add al, 0eh
int 10h
add al, 2
int 10h
jmp 7c02h

filler db 01FFh-(($-1)-7c00h) DUP(0)

I really don't know. I'm completely serious.

Name: Anonymous 2007-02-06 23:36

>>23

org 7c00h #Load this as 0x7c00?

mov ah,0eh #Places 10d in ah.
mov al,64h #Places 100d in al
int 10h    #Raises interupt 16d, whatever that is.
inc al     #al++
int 10h    #Raises interupt 16d
add al, 0eh#Adds 10 to al. al = 111d
int 10h    #Raises interupt 16d
add al, 2  #Adds 2 to al. al = 113d
int 10h    #Raises interupt 16d
jmp 7c02h  #Jumps to 0x7c02. Whatever that is.

filler db 01FFh-(($-1)-7c00h) DUP(0) #No idea.

Name: Anonymous 2007-02-07 0:16

well, i guess that's used to calibrate some assembly flags or something alike.

Name: Anonymous 2007-02-07 0:28

>>21

That's why you learn...

Name: Anonymous 2007-02-07 1:48

>>20
And Windows 3.1 was born...

Name: Anonymous 2007-02-07 3:20

>>20

Hm.. writing a sentence and you don't even know how grammar works.
Very nice, very nice.

Name: Anonymous 2007-02-07 3:34

>>27
Hm.. writting an OS and not knowing the basics of those things will result in being completely overwhelmed and writing a piece of shit.
Very nice, very nice.

Name: Anonymous 2007-02-07 3:43

>>24

filler db 01FFh-(($-1)-7c00h) DUP(0) ; fail + emu8086

times 0200h-($ - $$) db 0 ; nasm: output file = 512 bytes padded with null to neatly fill a disk sector. works as com file as well.

Name: Anonymous 2007-02-07 8:26

>>23

Haha, very good

Name: Anonymous 2007-02-07 8:26

>>24 if I remember it right, int 10h is used to set up your video card

Name: Anonymous 2007-02-07 9:03

>>27
Great lulz
Very nice, very nice.

Name: Anonymous 2007-02-09 8:53

One word, the forced indentation of code. Thread over.

Name: Anonymous 2009-01-14 14:51

Needs more CFLAGS

Name: Anonymous 2009-02-25 7:18

Learn C in X   days books are   pretty much THE   canonical tome on.

Name: Anonymous 2009-08-03 8:02

>>1
It kills you

Name: Anonymous 2009-08-03 8:06

GCC

Name: Anonymous 2011-02-03 6:37

Name: Sgt.Kabu냅㏬kiman섖亐 2012-05-28 22:26

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List