[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prototype __P



Quoth uri on Wed, Apr 07, 1999:
> So , what __P(argc) supposed to do ?

It's __P(args)...

Under ANSI C compilers, __P is defined as:
	#define __P(args)	args
Which means, that the function prototype such as:
	int func __P((int a, char *b));
is parsed, "args" becomes "(int a, char *b)", and the prototype
becomes:
	int func (int a, char *b);

Under K&R C compilers, __P is defined as:
	#define __P(args)	()
So a prototype such as:
	int func __P((int a, char *b));
becomes:
	int func ();
because "args" is discarded.

For more information, see a good book about the C language, such
as the book by Peter van der Linden called "Expert C Programming
-- Deep C Secrets".  Read about the difference between function
prototypes in K&R C and ANSI C.  Read about the C pre-processor.

Vadik.

-- 
The ill-formed Orange
Fails to satisfy the eye:
Segmentation fault.