tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: style change: explicitly permit braces for single statements



On Jul 13, 2020, at 9:13 AM, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> .  I find the braces pure visual clutter in the latter.

What really bugs me is when my code winds up with a security fail because I wasn’t careful.  I’ve had this happen maybe three or four times in my career, which isn’t too bad, but it’s hard to catch.  Once I hacked /bin/login to support Kerberos and made a mistake of this sort which allowed root logins without a password. Fortunately I caught it before anyone else noticed, not by code examination but because after many test cycles I accidentally hit return when logging in instead of typing in a password.

“Because it looks better” is not a good reason to write less safe code. C is dangerous enough without taking unnecessary risks. My current coding style _requires_ braces for all dependent clauses, even if there is only a single statement.



Home | Main Index | Thread Index | Old Index