Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!claris!sts!sts!bonzo!roy
From: roy@bonzo.sts.COM
Newsgroups: comp.lang.c
Subject: on the fringe of C syntax/semantics
Message-ID: <80100001@bonzo>
Date: 4 Oct 89 01:10:00 GMT
Lines: 24
Nf-ID: #N:bonzo:80100001:000:1393
Nf-From: bonzo.sts.COM!roy    Oct  3 17:29:00 1989


Here are a couple questions that come up in conjunction with using the
'varargs' series of function calls.  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?  You're not specifying a variable - it's only
a type.  I really am curious about what the semantics to the compiler
would be ...  The second question is in conjunction with how to
declare certain types.  Things like 'int' and 'char *' are a piece of
cake, but how about a good, general declaration for a function?
'(int *())' and '(int ())' were two tries at declaring a general function
that returns an 'int', but they didn't work.  Are you stuck with
something like '(int (*foo)())', where 'foo' is a particular function
or is there a better way to do this?  The only thing we've tried that
works is just to declare the type as 'char *'.  But that's ugly and
non-portable.  Any other ideas?


==================================================================
Roy Bixler                   | UUCP: ...!{claris,sun}!sts!roy    |
Semiconductor Test Solutions | Internet: roy@bonzo.sts.COM       |
4101 Burton Dr.              | phones: (408) 727-2885 x132 (work)|
Santa Clara, CA  95054	     |         (408) 289-1035      (home)|
==================================================================