Article View: comp.std.c++
Article #4023references and ellipsis
From: Laurent FRIGAULT
Date: Sat, 13 Apr 1996 23:17
Date: Sat, 13 Apr 1996 23:17
45 lines
2007 bytes
2007 bytes
Hi,
I discover a problem when trying to use a C++ reference to an object
just before an ellipsis :
int foo(const int& aInt,...){
va_list params;
va_start(params,aInt);
// ...
va_end(params);
return 0;
}
I try this kind of code under several environnement and it compile well.
g++ 2.7.2 under sunos 4.1.3 give me a warning:
warning: second parameter of `va_start' not last named argument
but the code works fine.
Under NT with BC++ 4.51 and VC++ 2.1, I dont get any warning, but
the generated code is wrong.
If I replace the reference with a pointer or an object, the code works
in all cases. I couldn't find anything about a reference before an ellipsis
on the draft, so I presume that the code is correct.
Can someone confirm if this is correct or not.
If yes, I presume that the problem is in the implementation of va_start
that uses sizeof on the reference.
regards
Lolo
--
Laurent Frigault | frigault@gla.ecoledoc.ibp.fr
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4kop8j$ino@vishnu.jussieu.fr>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: frigault@gla.ecoledoc.ibp.fr (Laurent FRIGAULT) Newsgroups: comp.std.c++,comp.lang.c++.moderated Subject: references and ellipsis Date: 13 Apr 1996 23:17:34 GMT Organization: Universites Paris VI/Paris VII - France Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4kop8j$ino@vishnu.jussieu.fr> NNTP-Posting-Host: taumet.eng.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Nntp-Posting-Host: daisy-gtw.ecoledoc.ibp.fr X-Newsreader: knews 0.9.5 Content-Length: 943 Originator: clamage@taumet