Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
How not to abuse a "for loop": examples?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Thomas Matthews, post: 2383238"] No. The point is that the index variable is modified within the block of statements. This was _not_ designed as a forever loop. Nope. The point here is that floating point arithmetic and comparison are not exact enough for this loop. One should not use floating point values for indices in a loop. This is another issue on unspecified behavior. The loop causes an underflow at m == 1. One cannot subract the value of "2" from "1" when the domain is restricted to all positive integers (including zero). This is undefined in terms of mathematics. -- Thomas Matthews C++ newsgroup welcome message: [URL]http://www.slack.net/~shiva/welcome.txt[/URL] C++ Faq: [URL]http://www.parashift.com/c++-faq-lite[/URL] C Faq: [URL]http://www.eskimo.com/~scs/c-faq/top.html[/URL] alt.comp.lang.learn.c-c++ faq: [URL]http://www.comeaucomputing.com/learn/faq/[/URL] Other sites: [URL]http://www.josuttis.com[/URL] -- C++ STL Library book [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
How not to abuse a "for loop": examples?
Top