Moving a project from IAR EW8051 to Keil PK51 because I have a restricted set of IAR tools and I have full set of Keil tools.
In many places in the code there is a construct such as for(uint8 i=0; i < 50; i++), etc.
Keil PK51 will say "undefined var i, etc". So I define i as uint8 i; and then PK51 will say datatype not allowed which is what I would expect. Remove the uint8 in the 'for' statement and Keil is happy.
For gents that have used both packages(I know Erik has), can you tell me if IAR has such a language extension or is there some type of macro that I been unable to find that would allow such a var definition within the 'for' statement. It is also used in 'if' statements and 'while' loops, etc.
Is this something I missed in C 101 or has shades of BASIC sneaked into IAR?
Oh yes, the project does build in IAR but not in Keil and not in TI Code Composer. I know Code Composer does not support the 8051 but I was just compiling short C files without device definitions. Have not tried Visual Studio.
Just looked again and saw IAR uses other datatypes such as char and uint16 datatype within 'for and 'if' statements.
Thanks,
Bradford
That's something which started in C++, and has been adopted by later 'C' standards - but is not supported by Keil C51.
"the project does build in IAR"
There will, almost certainly, be an option to set which language standard the compiler uses...
http://www.keil.com/support/man/docs/c51/c51_xa.htm
en.wikipedia.org/.../C99
A paper on changes in the "new" C9x versions:
home.datacomm.ch/.../c9x_changes.html
Andrew;
Thank you for dragging me slightly up to date.
intermingled declarations and code: variable declaration is no longer restricted to file scope or the start of a compound statement (block), similar to C++ from your referenced standard. I will review the IAR configuration options.
Thanks again. Hope this might help others.