Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Code Conversion

2005-04-19 by Colin Paul Gloster

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

and

void foo(void);

takes no parameters in K & R C and C89.

and

in C89, one may declare a prototype for a function whose quantity of
parameters is unspecified with

void foo(...);

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 ).

As for solving Chuck Hackett's porting problem, this does not. I do not
know why you are having problems. Chuck Hackett had said:

"[..]

Both functions are declared prior to their first use and
there are other "void funct()" functions which do not cause warnings.

[..]"

Where are the two rejected declarations declared (you did say "there" but 
that is a common English idiom)? Perhaps you need to check your
#ifdef settings. Though they might be declared before first being used,
where are they being used? Perhaps where they are called from is treated
as being part of a header file by GCC (with no function calls allowed) and
so their calls are being misinterpreted as declarations. Is a semicolon or
somesuch missing from before the declarations? Good luck.

Attachments

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.