On Wed, 07 Sep 2011 14:04:20 -0700, Harald van Dijk wrote:
> On Sep 7, 10:54Â pm, nathan <spamt...@trashcan.invalid> wrote:
>> I write C based software that I try to keep as portable as possible.
>> Therefore I support both K&R and ANSI headers.
>
> Are there actually any compilers that are of interest to you, that do
> not support function prototypes? Prototypes have been standard C for
> more than 20 years.
>
>> In one of these
>> headers, there is a pointer to a function with arguments. In ANSI
>> that's easy, but how about K&R C? Is it:
>
> K&R C does not have "function with argument" types. It has function
> types.
>
> In your header:
>
> int foo ();
>
> In your source file:
>
> int foo (bar, x, y)
> int (*bar) ();
> int x;
> int y;
> {
> return (*bar) (x, y);
> }
>
> Keep in mind that K&R C is not a actual standard, and pre-ANSI compilers
> vary in behaviour in different aspects.
Hi Harry,
I did some Googling last night and just didn't get the answer so I
mixed thing up:
The question is:
int foo (x, y)
int x;
int y;
{}
int bar (z)
int (*z) ();
{}
is this correct or do we need:
int (*z) (int, int);
int (*z) (x, y);
I hope you catch my drift now. Yes, it's to maintain compatibility
with an old system (Coherent).
Best
Nath