which loop is better

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
a small doubt on a loop. If i have to use a loop
which one is preffered/better - a "for" or a "while"
loop???

i had written small prog (2 files)

file 1 had

main()
{
	int i=10;
	for(;i--;);
}

file 2 had

main()
{
	int i=10;
	while(i--);
}

both of them produced the SAME assembly code.
so is there really ne reason why i shud pick one over the other???

- mandeep

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux