Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: Passing a `va_list *' Message-ID: <11442@smoke.BRL.MIL> Date: 30 Oct 89 14:09:26 GMT References: <11439@smoke.BRL.MIL> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 In article mcgrath@paris.Berkeley.EDU (Roland McGrath) writes: >I don't see the problem with whatever type `va_list' is. You can take the >address of an object of any type (though not every storage class), and >dereference the pointer thus obtained. I'm not sure there is a problem, but you need to check carefully what happens when va_list is an array type (which is permitted but not required by the Standard). I'm away from my copy of the Standard now, but for example if va_arg() were permitted to be a function, *args in the inner function would be an attempt to pass an array to va_args(), not just the name of an array (which would be converted to a pointer to the array's first element) as in the top-level function. I forget whether this usage would also result in conversion to a pointer to the first element, but if not then it is illegal (and if it did work, would result in the wrong type being passed to va_args()). I'll have to look this up and let you know. In any case &array will do something different in older PCC implementations than in Standard C (and is officially not allowed according to K&R1), so if the code has to work in both and environments, it may not be portable. I wish I remembered why we allowed (in one draft, even required) the va_list to be an array type. It sure is a nuisance.