Ctype.h (start arrays at 1 then add 1 before looking up)

chris at hwcs.UUCP chris at hwcs.UUCP
Thu Apr 5 19:39:36 AEST 1984


I prefer the following technique for -1 origin arrays (or indeed
any other origin).  I think it is easier to understand, because
it makes no assumption that C will preserve the order of fields
within a structure, and will insert no padding between them:

	------------------------------------------------------
	char	tableinit[129] = { /* Initial values ... */ };
	char	*table = tableinit+1;
	/* table is now an ARRAY [-1..128] OF CHAR, in Pascal
	 * terminology.
	 */
	------------------------------------------------------
Chris Miller



More information about the Comp.unix.wizards mailing list