[TUHS] FD 2

Dave Horsfall dave at horsfall.org
Wed Feb 1 07:27:41 AEST 2023


On Mon, 30 Jan 2023, Steve Nickolas wrote:

[...]

> I've actually been bitten by compilers doing unexpectedly stupid things, 
> so I guard around them.  I'll never merge two chars into a short with
> 
>   c=(a<<8)|b;

I used to do just that to disambiguate commands that started with the same 
letter in a UT-200 driver that I (re)wrote.  Of course, I was young and 
stupid back then...

It's quite something to see things like:

    switch (cmd)
    {
	case 'AA':
	    ...
	    break;

	case 'AB':
	    ...
	    break;

	default:
	    wtf();	/* no return */
    }

Horribly machine-dependent, but I knew the 11/40 and Ed 6 quite well.

[...]

> I'll never do if (a==b&&c==d), always if ((a==b)&&(c==d)).

Indeed; I *always* use parentheses even if they are not necessary (for
my benefit, at least).

-- Dave


More information about the TUHS mailing list