AnsweredAssumed Answered

Issue with function declarations when using register based parameter passing

Question asked by Marc Vandenhende on Feb 13, 2010
Latest reply on Feb 15, 2010 by Marc Vandenhende

I managed to convert my Coldfire Lite based applications to work correctly when compiled with the new CodeWarrior 7.2. All it actually took was to modify the assembler routines to use register based parameter passing.

 

I first had an issue with the UDP server in my app, but this was caused by an incorrect declaration of a function. The actual error there was that I forgot to assign a type to the parameters. Instead of writing...

 

 


void process_udp_packet(ip_addr host_ip, char *data, unsigned int data_len)
{
...
}

 

 

...I wrote...

 

 


void process_udp_packet( host_ip, data, data_len )
{
...
}

 

I did not use a function prototype for this function.

 

The odd thing is, this worked fine with stack-based parameter passing. The second odd thing is that the compiler did not throw an error or a warning when compiling this.

 

Is this normal behaviour for a C compiler? Is it possible to enable flagging of this kind of omissions?

Outcomes