Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!nntp.et.byu.edu!news.caldera.com!park.uvsc.edu!usenet From: Terry Lambert <terry@lambert.org> Newsgroups: comp.unix.bsd.netbsd.misc Subject: Re: What is __P() for? Date: 1 Dec 1995 01:03:58 GMT Organization: Utah Valley State College, Orem, Utah Lines: 48 Message-ID: <49lk9u$knc@park.uvsc.edu> References: <498eac$2gm@taco.cc.ncsu.edu> <DIs1rJ.GMz@deshaw.com> NNTP-Posting-Host: hecate.artisoft.com christos@deshaw.com (Christos Zoulas) wrote: ] In article <498eac$2gm@taco.cc.ncsu.edu> kpneal@eos.ncsu.edu (Kevin P. Neal) writes: ] >What is the purpose of this: ] > ] >int __P(functname(int arg)); ] > ] >(Did I do that right?) What is the point? Doesn't it just ] >get converted by the preprocessor into (funct...) anyway? ] > ] >I think this has something to do with ANSI C, but what is the ] >story behind it? ] ] I'll answer this one, but please in the future poke a bit around before ] you ask... You should look for it's #define definition in /usr/include: [ ... not quite an answer 8-) ... ] It's so you can declare extern functions, usually in header files, and have them be prototypes for ANSI C compilers (which define __STDC__) and K&R externs for non-ANSI C compilers. Some programs, even on GCC using systems, require you to use traditional compilation instead of ANSI for them to work right. So if __STDC__ is defined: int foo __P((int arg1, char * arg2)); Becomes: int foo (int arg1, char *arg2); And without __STDC__ defined, becomes: int foo (); So the same header files work on both K&R and ANSI compilers. Makes sense, really, since you might port to an old system and not want to have to drag all of GCC with you. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.