Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: on the fringe of C syntax/semantics Message-ID: <11216@smoke.BRL.MIL> Date: 4 Oct 89 20:51:09 GMT References: <80100001@bonzo> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 19 In article <80100001@bonzo> roy@bonzo.sts.COM writes: >When calling the va_arg() function, the 2nd parameter is supposed to be >simply a type, such as int, char, char *, etc. So, the first question >is, how does it know what type you specified? It doesn't work with all types, only those for which appending "*" produces a type that is a valid pointer to the argument type. Of course the va_arg() MACRO (not function) does this by straightforward macro expansion of the argument using a template where the expanded argument is followed by a "*". Sometimes you need to provide a typedef name, if the type is complex enough. >'(int *())' and '(int ())' were two tries at declaring a general function >that returns an 'int', but they didn't work. int (*)() is a valid type for a pointer to function (with unspecified argument information) returning an int value.