[net.sources.bugs] Bug in English to Phoneme Translation

wasser_1@viking.DEC (John A. Wasser) (04/02/85)

	There is a bug in the English to Phoneme translation I posted
	last week:

		In the routine leftmatch() there is a loop that looks
		like this:

			for ( ; pat != pattern ; pat--)

		This loop terminates early and should be changed to:
	
			int cnt;	/* Number of characters in pattern */
			.
			.
			.
			for (cnt = strlen(pattern) ; cnt > 0 ; pat--,cnt--)

	I do not recommend fixing this by changing the != to >= because
	the variables are pointers and relational operations on pointers
	are not very portable.

	The file containing this bug also needs definitions of TRUE and
	FALSE:

		#define FALSE 0
		#define TRUE (!FALSE)

	These seem to be pre-defined in VAX VMS 'C' under which the
	code was developed.

		-John A. Wasser

Work address:
ARPAnet:	WASSER%VIKING.DEC@decwrl.ARPA
Usenet:		{allegra,Shasta,decvax}!decwrl!dec-rhea!dec-viking!wasser
USPS:		Digital Equipment Corp.
		Mail stop: LJO2/E4
		30 Porter Rd
		Littleton, MA  01460

arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (04/11/85)

In article <1451@decwrl.UUCP> wasser_1@viking.DEC (John A. Wasser) writes:
>	The file containing this bug also needs definitions of TRUE and
>	FALSE:
>		#define FALSE 0
>		#define TRUE (!FALSE)
>	These seem to be pre-defined in VAX VMS 'C' under which the
>	code was developed.
>		-John A. Wasser

Using '#define TRUE (!FALSE)' (or vice versa) like this causes a huge number
of lint complaints about "constant used in conditional context".  This
makes it difficult to use lint.  If one is going so far as to make the
assumption that 0 == FALSE, why not take the (relatively tiny) extra
step and assume that 1 == TRUE?

faustus@ucbcad.UUCP (04/13/85)

I've seen several bug reports for the phoneme program and I think I
may have missed a few. Could the author post a up-to-date copy?

	Wayne