On Tue, Feb 22, 2005 at 05:45:22PM -0000, kc9dag wrote:
"[..] Things have been going fine and now I am getting the
following error:
Datalogger.c: In function `main':
Datalogger.c:48: error: redeclaration of 'inty' with no linkage
Datalogger.c:48: error: previous definition of 'inty' was here
Datalogger.c:48: error: parse error before '<' token
Datalogger.c:48: error: parse error before ')' token
Datalogger.c:48: warning: unused variable `inty'
for this chunk of code:
45 for(unsigned int x = 0; x <= pagecount; x++)
46 {
47 Page_To_Buffer(x, 1);
48 for(unsigned int inty = 0, inty < 0xFF; inty++)
49 {
50 sendChar(Buffer_Read_Byte(1, inty));
51 }
52 }
[..]"
I do not know what would happen if you would try line 48's accidental
comma instead of a semicolon in C#, but in Java you would be saved with an
error message and in ex-ANSI C (C89) that error would get through and
wreak havoc at runtime so consider yourself lucky that your AVR C compiler
caught that warning.
For clarity's sake: replace line 48 with
for(unsigned int inty = 0; inty < 0xFF; inty++)
Regards,
Paul Colin Gloster
P.S. In future you might try programming in C++, so do not use
postoperators as in inty++ when a preoperator is equivalent (i.e. in this
case ++inty) because in C++ for nonprimitive types (though unsigned int
is primitive, it is a habit not to encourage), postincrement can be
more expensive.Message
Re: [AVR-Chat] What does this error mean?
2005-02-22 by Paul Colin Gloster
Attachments
- No local attachments were found for this message.