Re: Compiler error during porting exercise

2006-08-15 Thread Philip Guenther

On 8/2/06, Otto Moerbeek [EMAIL PROTECTED] wrote:

On Wed, 2 Aug 2006, Michael C wrote:

...

 Why is it that the MetroWerks CodeWarrior 3.1 cannot handle the following?

 in header file (pcb.h):
 intin_baddynamic (u_int16_t, u_int16_t);

 in c file (pcb.c)
 int
 in_baddynamic (a, b)
   u_int16_ta;
   u_int16_tb;
 {...}

 CodeWarrior complains with a 'identifier redeclared' error.

 Is it because the declaration is a different style to the definition?

Maybe, but this is legal C.


Legal GNU C, yes, but not legal ISO/ANSI C.  This is a documented GNU
C extension; in the gcc info pages follow the C Extensions and then
Function Prototypes items.

Of course, OpenBSD has never supported compilation with anything but
*its own* gcc.  This is just another example of an extension (albeit
one in plain gcc) that a compiler must support to correctly handle the
OpenBSD source tree.


Philip Guenther



Re: Compiler error during porting exercise

2006-08-14 Thread Woodchuck
On Wed, 2 Aug 2006, Michael C wrote:

 Hi,
 
 I am trying some porting examples to winscw and I have a question:
 
 Why is it that the MetroWerks CodeWarrior 3.1 cannot handle the following?
 
 in header file (pcb.h):
 intin_baddynamic (u_int16_t, u_int16_t);
 
 in c file (pcb.c)
 int
 in_baddynamic (a, b)
   u_int16_ta;
   u_int16_tb;
 {...}
 
 CodeWarrior complains with a 'identifier redeclared' error.
 
 Is it because the declaration is a different style to the definition?
 I am not use -strict, maybe the compiler just can't handle it?
 
 I have searched the whole tree and there is only one declaration and one
 definition.

I cannot address the CodeWarrior directly, but sometimes things glitch
when the type of declaration made in pcb.h are made.

try instead in pcb.h

int in_baddynamic(u_int16_t a, u_int16_t b);

I agree, both types should compile.  If this fixes it, you might complain
to MetroWerks.

Dave
-- 
Experience runs an expensive school, but fools will learn in no other.
   -- Benjamin Franklin