Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] What does this error mean?

2005-02-22 by Paul Colin Gloster

On Tue, Feb 22, 2005 at 12:07:41PM -0600, Mike Murphree wrote:

"What evilness allows you define variables inside a for loop structure
like that?

Take them out, and precede this code with:

unsigned int x, inty;
"

One correct answer to the question is ANSI C. In ANSI C++ and Java at 
least, as was probably the rationale for ANSI C, the idea is to not pay 
for a variable you never use if a particular run of the program does not 
reach that loop.

Incidentally, at least in C89 would Mike's example not run the risk of x 
and inty having different datatypes?
unsigned int x;
unsigned inty;
would be safer.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.