make the compiler friendlier by matching brackets

The error messages that result from inadvertantly erasing a } bracket are so obscure they often do not lead to the problem.

How about adding a simple bracket counter so if there are a different number of left brackets than right brackets it tells you to look for that. This would sure help us beginners.

Or adjust your writing style so that mis-matched brackets are easier to see. Put every { and every } on its own line.

if(a ==1)

Couple that with auto format and misplaced brackets usually stand right out.

What version of the IDE do you have? The latest ones highlight bracket pairs and even display function names if they end one.

The latest ones highlight bracket pairs

You need to click next to a bracket and then the matching one of the pair is highlighted.

Another help for bigger sketches is to use the free editor “Notepad++” and set the language to C++. Then it highlights all the bracket pairs including embedded ones. See:

That’s what I use when I get really screwed up!

In Visual Studio you can highlight one brace, click ctrl+] and the cursor will jump to the matching brace.

reply #1 is the solution

Tools + Auto Format WILL tell you that you have the wrong number of right or left braces, or will line things up neatly, though not necessarily correctly, if you have the same number of each.