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!watmath!clyde!cbosgd!cbdkc1!desoto!cord!hudson!bentley!hoxna!houxm!mhuxt!mhuxr!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: How do I declare... Message-ID: <1406@umcp-cs.UUCP> Date: Tue, 27-Aug-85 06:50:13 EDT Article-I.D.: umcp-cs.1406 Posted: Tue Aug 27 06:50:13 1985 Date-Received: Wed, 28-Aug-85 10:21:38 EDT References: <368@persci.UUCP> <159@rtp47.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 37 It is interesting to note that recursive type definitions make sense only for function pointers, and only because they have side effects. Defining (a pointer to)+ makes no sense, because you can never do anything with it. It only points. You can do an infinite number of indirections and it still just points. With function pointers, however, indirecting through them causes side effects; one such effect can be "terminate this program", which is the magic clause that makes this useful. Fascinating. By the way, note that structure declarations such as struct foo { struct foo *next; ... }; are not really recursive. The inner entity is a pointer to struct foo, not a struct foo. Also by the way, the "most portable" declaration for (function returning pointer to)+ is probably *(*(*foo())())() as this forces the function to return a pointer to a function that returns a pointer; even if pointers to basic types are of different sizes, most any compiler will have pointers to "pointer to function returning pointer to " being the same size as pointers to "pointer to function returning pointer to function returning pointer to " and so forth. -- 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