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-08 by Paul Curtis

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.

-- Paul.
Show quoted textHide quoted text
> -----Original Message-----
> From: Chuck Hackett [mailto:egroupscdh@WhiteTrout.net] 
> Sent: 08 April 2005 13:13
> To: AVR-Chat@yahoogroups.com
> Subject: [AVR-Chat] Code Conversion
> 
> 
> I have purchased an ATMega16 based board to connect a project 
> to the Internet.
> I'm attempting to compile my first real embedded program.  
> The example code that came with the board was written for 
> ImageCraft's ICCAVR Pro C compiler and I'm currently 
> converting it to WINAVR.  I'm trying to digest all the 
> documentation but my unfamiliarity with both compilers is 
> hampering me.  If you would indulge me with a couple of questions:
> 
> I have two functions that are being flagged with the 
> following warning:
> 
> "function declaration isn't a prototype"
> 
> One is declared:
> 
> void overrun()
> {
> ...
> }
> 
> ... and the other ...
> 
> void init_ASIX88796L()
> {
> ...
> }
> 
> Both functions are declared prior to their first use and 
> there are other "void funct()" functions which do not cause warnings.
> 
> - What exactly is this trying to tell me?
> - Where can I find descriptions of the various warnings and 
> errors from WINAVR?
> 
> 
> I came across a couple of occurrences of:
> 
>     do{
>         ...
>         result = byte_read & RDC;
>     }while (result = 0);
> 
> Shouldn't "while (result = 0)" be "while (result == 0)" ?
> 
> 
> If I understand it correctly I should convert the following code:
> 
> #pragma interrupt_handler USART_RX_interrupt:iv_USART_RX ...
> void USART_RX_interrupt( void )
> {
> ...
> }   
> 
> ... to ...
> 
> SIGNAL(SIG_USART_RECV)
> {
> ...
> }   
> 
> 
> Are there general guidelines available on the Internet 
> concerning converting ImageCraft's ICCAVR Pro C code to WINAVR?
> 
> Thanks in advance for your help.
> 
> Cheers,
> 
> Chuck Hackett
> "Good judgment comes from experience, experience comes from 
> bad judgment"
> 7.5" gauge Union Pacific Northern (4-8-4) 844 
> http://www.whitetrout.net/Chuck
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
>

RE: [AVR-Chat] Code Conversion

2005-04-08 by Chuck Hackett

> From: Paul Curtis [mailto:plc@rowley.co.uk]
> 
> 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.
> 
> -- Paul.
> ....

That makes sense except that there are many functions declared similar to "void
foo()" that do not generate warnings.  I'm at a loss to see what makes these
particular two different.

Cheers,

Chuck Hackett
"Good judgment comes from experience, experience comes from bad judgment"
7.5" gauge Union Pacific Northern (4-8-4) 844
http://www.whitetrout.net/Chuck

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.

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.