Meaning of this for-loop written ina mex file
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Jan
2011-10-13
It is simply a bad programming style. The "ir = ir" can be omitted:
for( ; ir <= temp; ir++) { }
0 个评论
更多回答(1 个)
Kasun Talwatta
2011-10-13
1 个评论
James Tursa
2011-10-13
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!