Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!duke!unc!tim From: tim@unc.UUCP (Tim Maroney) Newsgroups: net.lang.c Subject: Re: void casts; and C definition question Message-ID: <5973@unc.UUCP> Date: Tue, 4-Oct-83 17:55:14 EDT Article-I.D.: unc.5973 Posted: Tue Oct 4 17:55:14 1983 Date-Received: Fri, 7-Oct-83 02:37:13 EDT References: wjh12.327 Lines: 22 The cited use of the (void) type cast is indeed incorrect if the operator precedence rules of Kernighan and Ritchie are correct. The example given went like: (void) foo(x); to show that nothing important is returned from foo. In fact, the parentheses of the function call argument list group first, meaning that the value returned by foo is a function of type void. To do it right, you would have to say: ((void) foo)(x); I suppose that the rather sloppy definition of void in the public documentation would allow you to make a weak case for the former being correct, though. Still, special properties of void notwithstanding, only the latter form is correct. Isn't C wonderful? Wait, let me leave the room before you answer... _________________________ Tim Maroney, duke!unc!tim