Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!princeton!allegra!alice!bs From: bs@alice.UucP (Bjarne Stroustrup) Newsgroups: net.lang.c++ Subject: DMD problems; f(); Message-ID: <6104@alice.uUCp> Date: Wed, 24-Sep-86 04:40:35 EDT Article-I.D.: alice.6104 Posted: Wed Sep 24 04:40:35 1986 Date-Received: Thu, 25-Sep-86 18:44:03 EDT Organization: Bell Labs, Murray Hill Lines: 20 > Guido van Rossum, CWI, Amsterdam > ... error is emitted by CC for a more conventional fragment like this: > > extern int f(); > main() { f(1); } > > "x.c", line 2: error: un expected 1 argument for f() > > The error is simply that f() is declared as a function with no argument, > but called as a function with one argument. This is an error in C++, > but not in C. Unfortunately C++ has chosen a different solution to cope > with this incompatibility than [proposed] ANSI C; in ANSI C, f() means > that f's arguments are unknown, and one writes f(void) to state > explicitly that f has no arguments. ... I may be worth nothing that the example above is also bad ANSI C. Calling a function with an argument after it has been declared without one is a case where ANSI C recommends issuing a warning. Thus, a good ANSI C compiler will agree with C++ here. If you mean to declare ``f(accept_any_old_garbage)'' you can write ``f(...)'' in both C++ and ANSI C.