On Sun, Jan 27, 2002 at 12:53:05PM -0500, cwright@softpixel.com wrote: > however, sched.c doesn't seem so nice =) in many of the functions, there are > goto's with no apparent reason, especially in schedule() itself (look at > move_rr_last/back and in_interrupt). is there a reason for this? i have yet > to look at the gcc -save-temps output to see if its some kind of optimization > or some form of code obscurity. I would imagine gcc would replace a goto with > a jmp (on x86 at least) in almost all cases, unless its smarter than that. It is commonly both an optimisation AND leads to more readable code. Using goto can reduce code size and also can keep all "cleanup" code in one place. > some parts are clearly a loop of some sort, but others, as mentioned above, > exist with only one calling goto present, and their return is either a return > from schedule() or a goto back to right after the goto. the ugly gotos are optimisations resulting from examination of the generated assembly. > would replacing some of the goto insanity with plain linear code improve > performance any (negligible most likly, but a little at least)? it will reduce performance most likely. regards john -- "In no sense is [in]stability a reason to move to a new version. It's never a reason." - Bill Gates -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/