EEG!!
dicembre 3rd, 2009 Posted in Elettronica, Le imprese di Mastro Gippo
Dopo una lunga agonia, sono finalmente riuscito a completare la pagina che documenta il mio esperimento con un EEG… Per leggerla potete cliccare sul relativo link sulla barra dei titoli, o cliccare qui. Grazie!
2 Responses to “EEG!!”
By Ray on lug 24, 2010
I had a quick look at your source for the EEG project…
a few comments…
you should ALWAYS put { } for all if/while/for, even if there is only 1 command in them. Thus is you ever modify you code in the future and add another command, you will not make a bug that is VERY hard to find…
so this is wrong
if (a==1) {
a++;
b++;
} else
B++;
this is better
if (a==1) {
a++;
b++;
} else {
b++;
}
Also i find it is better to put the { on the same line as the if/for/while and the } on it own line… then it is easier to find the } for a statement and the number of lines on the screen is less… and you can see more of what you are writting
By Mastro Gippo on lug 24, 2010
Hi, thank you for your feedback. I have always left out brackets for single lines of code, because I like it this way and I think it’s more readable. The indentation reminds me that I have to add them if I add more lines. In years of programming I’ve never been bitten by this bug, so I guess this works for me…
I also like to put {} in their own lines, as a habit. I never knew it was called “Allman style”, but since “Proponents of this style often cite its use by ANSI and in other standards as justification for its adoption.”, I guess that I use it because ANSI uses it!