Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

RE: [AVR-Chat] Code Conversion

RE: [AVR-Chat] Code Conversion

2005-04-19 by Paul Curtis

Hi, 

> On Fri, Apr 08, 2005 at 02:08:15PM +0100, Paul Curtis wrote:
> 
> "I believe it's the difference between
> 
> void foo();
> 
> And
> 
> void foo(void);
> 
> The first is a function that takes unspecified parameters and 
> the second is a function that takes no parameters."
> 
> Please forgive me if I make serious mistakes here, but I believe that
> 
> void foo();
> 
> may take unspecified parameters in K & R C but must take no 
> parameters in
> C89

No, it takes unspecified parameters in C89 and C99.

> and
> 
> void foo(void);
> 
> takes no parameters in K & R C and C89.

void foo(void) is ILLEGAL in K&R C, it was an ANSI extension.  K&R C
doesn't even have prototypes!

> in C89, one may declare a prototype for a function whose 
> quantity of parameters is unspecified with
> 
> void foo(...);

No, you may not.  You are required to have AT LEAST one fixed parameter
before the ellipsis (...) and so your example declaration is incorrect.

> and in so far as this discussion goes, I suspect that C89 and 
> C99 are the same (with void foo(); being equivalent to void 
> foo(void); ), not that GCC actually supports C99 ( 
> HTTP://GCC.GNU.org/gcc-3.4/c99status.html ).

No, void foo(void) and void foo() are NOT the same for the reasons
specified above.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and (soon) MAXQ processors

Re: [AVR-Chat] Code Conversion

2005-04-19 by Colin Paul Gloster

Hi,

On Tue, Apr 19, 2005 at 04:18:20PM +0100, Paul Curtis wrote:

"[..]
> 
> void foo(void);
> 
> takes no parameters in K & R C and C89.

void foo(void) is ILLEGAL in K&R C, it was an ANSI extension.  K&R C
doesn't even have prototypes!

[..]"

Good point.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.