Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!warwick!nott-cs!gas From: gas@cs.nott.ac.uk (Alan Shepherd) Newsgroups: comp.lang.c++ Subject: AT&T 2.1 and stdargs Message-ID: <1990Sep19.062219.29519@cs.nott.ac.uk> Date: 19 Sep 90 06:22:19 GMT Reply-To: gas@cs.nott.ac.uk (Alan Shepherd) Organization: Nottingham University Lines: 34 I've just installed AT&T 2.1 on a sparc station 1 running sunos4.1 and I'm having real trouble with stdargs. The code for the routine is below: void as_log(char* message1, ...) { aslog.open(logfile.chars(),ios::app); if (!aslog.good()) return; va_list ap; va_start(ap, message1); aslog << message1 << " "; char* ptr = va_arg(ap,char*); while ((ptr) && (*ptr != NULL)) { aslog << ptr; ptr = va_arg(ap,char*); } va_end(ap); aslog << endl; } The problem is that for no apparent reason and at varying times, the parameters to as_log get confused. The first parameter (message1) is always fine, but the rest sometimes become garbage. I've run it through a debugger and the values in the calling routine are still fine. Has anyone else experienced this problem ? Is there something wrong with my code ? (It worked with 2.0). Another issue: cfront 2.1 seems to use up an awful lot of memory (8M!) whilst executing. Is this normal ? I often have to kick everybody off the machine so I can compile avoiding memory errors ! Alan Shepherd