Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!dave From: dave@utcsrgv.UUCP (Dave Sherman) Newsgroups: net.lang.c Subject: Re: var args Message-ID: <2497@utcsrgv.UUCP> Date: Sun, 16-Oct-83 04:43:07 EDT Article-I.D.: utcsrgv.2497 Posted: Sun Oct 16 04:43:07 1983 Date-Received: Sun, 16-Oct-83 14:51:34 EDT References: <3637@duke.UUCP> Organization: The Law Society of Upper Canada, Toronto Lines: 31 Charlie Martin (duke!crm) asks how to implement variable arguments. In C or on a particular machine? As Henry Spencer points out, it's not portable and therefore not strictly valid C. However, on a PDP-11 or VAX, you can have the routine routine(firstarg) int *firstarg; { int **argptr; argptr = &firstarg; ... argptr++; ... } and refer to *argptr to mean your arguments, **argptr if you want the character it points to, etc. I have several programs which do this sort of thing. It's obviously not guaranteed to be portable to other machines. It is a useful construct, though, and it seems quite likely that for any given machine you want to take such code to, you can figure out what needs doing. Those arguments have to get passed somehow, so although the incrementing might be different the same basic technique should continue to work. Dave Sherman Toronto -- {cornell,decvax,ihnp4,linus,utzoo,uw-beaver}!utcsrgv!lsuc!dave