Jeffrey Altman <[EMAIL PROTECTED]> writes:

> > Richard Levitte - VMS Whacker <[EMAIL PROTECTED]> ,in message <20000202220
> The Visual C++ compiler does not compile a  .c file with C++ semantics
> unless a special command line switch is thrown.  stack.c is being
> compiled as a ANSI C program.  The compiler is correct.  
> 
>   void (*func)()
> 
> means
> 
>   void (*func)(void)
> 
> in ANSI C.
This is incorrect. In C, both ANSI and K&R, declaring a function
as 

f();

is equivalent to 

f(...);

In order to declare a function that takes no arguments in ANSI
C, you declare it as

f(void);

Without this behavior, it would not be possible to compile any
K&R C code with an ANSI compiler, which is obviously undesirable.

In C++, however, you declare a function that takes no arguments
using

f();

In fact, this is one of the major incompatibilities between
C++ and ANSI C.

>From the C++ FAQ:
--snip--
[6.10] Is C++ backward compatible with ANSI/ISO-C?

Almost. 

C++ is as close as possible to compatible with C, but no closer. In
practice, the major difference is that C++ requires prototypes, and
that f() declares a function that takes no parameters (in C, f() is
the same as f(...)).
--snip--

-Ekr

-- 
[Eric Rescorla                                   [EMAIL PROTECTED]]
          PureTLS - free SSLv3/TLS software for Java
                http://www.rtfm.com/puretls/
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to