can anyone find this in the ANSI C standard

I am not asking what it will do, that is a simple experimnt that I can do myself. Does anyone have specific knowledge of whether the following for loop where WFLcnt is an unsigned char is specified in the ANSI C standard to run 0 or 256 times.

  for ( WFLcnt = 0 ; WFLcnt !=0 ; WFLcnt++)
  {
   .....
  }
YES, if WFLcnt was a short, the question is moot, but i need to use a char for speed reasons. in advance, thanks Erik

Parents
  • "I am not asking what it will do, that is a simple experimnt that I can do myself. Does anyone have specific knowledge of whether the following for loop where WFLcnt is an unsigned char is specified in the ANSI C standard to run 0 or 256 times."

    The simple answer to your question is that the ANSI standard guarantees that the loop will run zero times. Whether you use an unsigned char or a short is irrelevant.

    I'd advise you to get hold of a decent 'C' book before going any further. If you don't get a good grasp on the basics of 'C' early on you'll run in to all sorts of unexpected traps.

Reply
  • "I am not asking what it will do, that is a simple experimnt that I can do myself. Does anyone have specific knowledge of whether the following for loop where WFLcnt is an unsigned char is specified in the ANSI C standard to run 0 or 256 times."

    The simple answer to your question is that the ANSI standard guarantees that the loop will run zero times. Whether you use an unsigned char or a short is irrelevant.

    I'd advise you to get hold of a decent 'C' book before going any further. If you don't get a good grasp on the basics of 'C' early on you'll run in to all sorts of unexpected traps.

Children
More questions in this forum