Meaning of this for-loop written ina mex file
조회 수: 2 (최근 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!