🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bjarne Stroustrup Wed, 24 Sep 1986 08:40
DMD problems; f();
#325
Author: Bjarne Stroustrup
Date: Wed, 24 Sep 1986 08:40
20 lines
1437 bytes
> Guido van Rossum, CWI, Amsterdam <guido@mcvax.uucp>
> ... 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads