Strictness of language styling

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 10 15:23:08 PST 2014


On 11/10/2014 02:00 PM, H. S. Teoh via Digitalmars-d-learn wrote:

 > (I kid you not, people
 > actually exist who write code like this):

I know one of those people! They are from a different era. :)

 > 	int my_func(int arg) {
 > 		if (arg==1) {
 > 			printf("One\n");
 > 			}
 > 		else {
 > 			printf("Not one\n");
 > 			}
 > 		for (i=0; i<10; i++) {
 > 			int x = i*2;
 > 			do_something_else(x);
 > 			}
 > 		}

Note especially how that last brace is there to get the unwary! :)

 > I think I needed therapy after encountering this. :-P

Same here! At least they used curly brackets for single-statements in 
the code above. In my case, they are truly optional. :(

(By the way, do you happen to know whether there are Emacs coding styles 
that help with that syntax? I could use one.)

Ali



More information about the Digitalmars-d-learn mailing list