Poll on style issue in comparison

John McNamee jpm at BNL44.ARPA
Wed Sep 25 08:47:55 AEST 1985


[I tried to send this via mail to rcd%opus.uucp at BRL.ARPA, but it was
 rejected, so I'm posting it instead. The original article was asking
 about placing the constant on the left side of the equals sign in if
 tests (i.e. "if (0==strcmp(a,b))").]

>1.  Do you use this form of comparison?

No.
	
>2.  Regardless of whether you use it, how do you feel about it (e.g., other
>    people using it in code that you will maintain)?
>	- dislike it
>	- neutral (OK if you want to do it)
>	- like it

I refuse to work on code that is written that way. I once spent a whole day
undoing that style from a program I had to make changes to.

>3.  If you use or like this way of writing comparisons, how do you feel
>    about also writing ordering tests with the constant first, as
>	if (0<x) ...
>    - dislike
>    - neutral
>    - like

People who do that should be taken out and shot. No, on second thought that
would be too quick. They should be tortured before being taken out and shot.

Comment:

What you do in private with consenting compilers is your own business, but
if I'm going to have to maintain your code then you don't have the right
to inflict your style on me. K&R style is readable, and is the standard.
Other than special permission from God, there is no excuse for anything
but K&R style.
--
			 John McNamee
		..!decvax!philabs!sbcs!bnl44!jpm
			jpm at BNL44.ARPA

		  "MS-DOS is a communist plot"



More information about the Comp.lang.c mailing list