Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-unix!hplabs!hp-sdd!ncr-sd!ncrcae!sauron!wescott From: wescott@sauron.UUCP (Mike Wescott) Newsgroups: comp.lang.c++ Subject: Re: Problem making cfront 1.1 on 4.3BSD Message-ID: <765@sauron.UUCP> Date: Mon, 24-Nov-86 12:13:03 EST Article-I.D.: sauron.765 Posted: Mon Nov 24 12:13:03 1986 Date-Received: Tue, 25-Nov-86 03:20:36 EST References: <3960003@nucsrl.UUCP> Reply-To: wescott@sauron.UUCP (Mike Wescott) Organization: NCR Corp., Advanced System Development, Columbia, SC Lines: 40 In article <3960003@nucsrl.UUCP> gore@nucsrl.UUCP (Jacob Gore) writes: > Now I have a problem with making cfront, and also a question about some > code in src/main.c. > > The question I have is about a related portion of src/main.c: > =================================== > typedef void (*ST)(...); // trick to circumvent problems with old > ST sick = ST(&signal); // (or C) versions > sick(SIGILL,core_dump); > ... > =================================== > Now, if I understand this correctly, 'sick' is a pointer to the 'signal' > function. In that case, shouldn't the call be "(*sick)(SIGILL,core_dump);"? Not necessarily. Both expressions are equivalent in C++ as well as in C. For C++, see "The C++ Programming Language" by B. Stroustrup, from the Reference Manual section 7.1: " A function call is a primary expression followed by parentheses containing a possibly empty, comma-separated list of expressions which constitute the actual arguments to the function. The primary expression must be of type ``function returning ...'' or ``pointer to function returning'', and the result of the function call is of type ``...''. I can't find a similar blessing in K&R, but my reading of 3.3.2.2 of the July 9 draft of the ANSI-C standard leads me to believe that it is legit in C as well. Besides, the compilers take it. There is, however a bug in the way the statement is converted to C. The original code (version 1.1) would, on most machines work and produce reasonable C code. A recent fix to print.c posted by Dr. Stroustrup fixed one problem but made the situation worse for compiling this section of main.c. I am posting another article with this fix and another. -- -Mike Wescott ncrcae!wescott