Compilers and programming style (was Re: A question of style)

P E Smee exspes at gdr.bath.ac.uk
Fri Jan 5 21:04:38 AEST 1990


In article <15065 at bfmny0.UU.NET> tneff at bfmny0.UU.NET (Tom Neff) writes:
>If you have a specialized systems/hardware-type situation where merely
>referring to a variable has useful side effects, then you can cast it
>to (void) or some such, to make this obvious.  Otherwise, it's probably
>a coding error and lint should catch it.

True, always best to leave flags for whoever has to maintain your code
next.  (If you're unlucky, it might even be you. :-)  A useful use of
(void) casts.  I also like to use '/* nobreak; */' statements when I
want a switch case to fall through.

>The issue of how much of lint's work the c compiler ought to do is a
>separate one.

My humble opinion is none at all, unless the compiler has a -switch which
allows you to ask for it, and you've used the switch.

-- 
Paul Smee, Univ of Bristol Comp Centre, Bristol BS8 1TW, Tel +44 272 303132
 Smee at bristol.ac.uk  :-)  (..!uunet!ukc!gdr.bath.ac.uk!exspes if you MUST)



More information about the Comp.lang.c mailing list