Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!chris
From: chris@umcp-cs.UUCP (Chris Torek)
Newsgroups: net.lang.c
Subject: Re: more about programming style
Message-ID: <1168@umcp-cs.UUCP>
Date: Fri, 9-Aug-85 08:11:06 EDT
Article-I.D.: umcp-cs.1168
Posted: Fri Aug  9 08:11:06 1985
Date-Received: Mon, 12-Aug-85 02:41:56 EDT
References: <732@dataio.UUCP> <4067@alice.UUCP> <6491@ucla-cs.ARPA>
Organization: U of Maryland, Computer Science Dept., College Park, MD
Lines: 27

(Perhaps I should just let this one slide by, but I'm feeling
particularly ornery this morning :-) ....)

>So you can understand:
>    int (*foo[10])();
>That doesn't help someone who is reading your program who doesn't.
>But writing the declaration as done below does.
>   typedef int (*PFI)();          /* pointer to function returning int */
>   PFI foo[10];

Much better than either of those is, instead, doing the following:

	/*
	 * Each input character in the range '0'..'9' invokes the
	 * corresponding translation function from the table below.
	 * The translation function returns the new state.
	 */
	int (*trans_function[10])() = {
		...

(or	PFI trans_function[10] = { ... ).

Describe the *purpose* of the data structures!
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland