AnthonyVillacorta / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Common syntax error detection #71

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Many questions on the forums are the result of syntax errors that are
common with newcomers to the C/C++ language. I would like to see the
Arduino IDE provide some guidance to help users avoid these common mistakes.

For example, the IDE could detect constructs such as:

void foo();{}

while(condition);

if (i = 0){...}

Often these are technically valid, but probably not what new users mean. As
a result the error messages provided by the compiler are not very helpful,
or there is no error and the code just doesn't work as expected.

I'd like to see the IDE provide a configuration file of patterns that would
match against the most common of these mistakes and when matched provide a
clear explanation of what the syntax means compared to what the user might
have meant.

A connected feature would be an enforced indentation style. New users often
don't make an effort to keep code blocks indented correctly or
consistently, leading to blocking errors that can be difficult for them to
find. If the IDE hand an on-by-default option to enforce indention,
automatically reformatting as needed similar to Visual Studio and other
popular editors, users would be less likely to encounter problems as a
result of indentation errors.

Original issue reported on code.google.com by davidkna...@gmail.com on 2 Aug 2009 at 1:37

GoogleCodeExporter commented 9 years ago
That's a great idea, especially for novices.

Original comment by bln.sch...@googlemail.com on 7 Aug 2009 at 2:01

GoogleCodeExporter commented 9 years ago
Using lint would catch these 'errors' - perhaps this should be run when a user
presses the Verify (triangle) button.

I'd rather not do it on Upload - as that takes long enough!

Original comment by rleylan...@gmail.com on 26 Aug 2009 at 8:12

GoogleCodeExporter commented 9 years ago
if not an error, then perhaps a warning msg might be better

Original comment by emyl...@gmail.com on 19 Feb 2013 at 2:29