Meaning of this for-loop written ina mex file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
Can someone please shed some light about this particular for-loop that I came across.
for(ir = ir; ir<=temp; ir++){ }
The initial value seems to equal to each other !. What is the meaning of that ?
0 Kommentare
Akzeptierte Antwort
Jan
am 13 Okt. 2011
It is simply a bad programming style. The "ir = ir" can be omitted:
for( ; ir <= temp; ir++) { }
0 Kommentare
Weitere Antworten (1)
Kasun Talwatta
am 13 Okt. 2011
1 Kommentar
James Tursa
am 13 Okt. 2011
Or an infinite loop. E.g. if ir is unsigned and temp is the max value (or greater) for that unsigned type, or if ir is a signed integer type and the compiler uses modulo arithmetic for signed integer overflows and temp is the max value (or greater) for that type, etc. etc.
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!