lijewski@batcomputer.tn.cornell.edu (Mike Lijewski) (09/15/89)
The docuentation on default initializers seems somewhat fuzzy
on this issue, though I would expect the following to work.
Unfortunately, it seems that only one declaration of ff() is
remembered after it's initial definition.
Script started on Fri Sep 15 12:30:08 1989
robbie(1)->cat a.cc
#include <stream.h>
void ff(int i, int j, int k)
{
cout << i << " " << j << " " << k << "\n";
}
void ff(int, int, int = 7);
void ff(int , int = 6, int);
void ff(int = 5, int, int);
main()
{
ff();
return 0;
}
robbie(2)->g++ -v a.cc
g++ version 1.36.0-
/usr/local/lib/gcc-cpp -+ -v -I/usr/local/include/g++-include -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus -Dunix -Di386 -Dsun386 -Dsun -D__unix__ -D__i386__ -D__sun386__ -D__sun__ a.cc /tmp/cca02344.cpp
GNU CPP version 1.35.96
/usr/local/lib/gcc-cc1plus /tmp/cca02344.cpp -quiet -dumpbase a.cc -noreg -version -o /tmp/cca02344.s
GNU C++ version 1.36.0- (80386, Sun syntax) compiled by GNU C version 1.35.96.
default target switches: -m80387
a.cc:9: all trailing parameters must have default arguments
a.cc:10: all trailing parameters must have default arguments
robbie(3)->exit
script done on Fri Sep 15 12:31:01 1989
--
Mike Lijewski (H)607/277-7623 (W)607/255-0539 (desk)607/255-2960
Cornell National Supercomputer Facility
ARPA: mjlx@cornellf.tn.cornell.edu BITNET: mjlx@cornellf.bitnet
SMAIL: 1122 Ellis Hollow Rd. Ithaca, NY 14850tiemann@SUN.COM (Michael Tiemann) (09/20/89)
Date: 15 Sep 89 16:40:43 GMT
From: lijewski@tcgould.tn.cornell.edu (Mike Lijewski)
Organization: Cornell National Supercomputer Facility
Sender: bug-g++-request@prep.ai.mit.edu
The docuentation on default initializers seems somewhat fuzzy
on this issue, though I would expect the following to work.
Unfortunately, it seems that only one declaration of ff() is
remembered after it's initial definition.
Wrong diagnosis; see below.
Script started on Fri Sep 15 12:30:08 1989
robbie(1)->cat a.cc
#include <stream.h>
void ff(int i, int j, int k)
{
cout << i << " " << j << " " << k << "\n";
}
void ff(int, int, int = 7);
void ff(int , int = 6, int);
void ff(int = 5, int, int);
main()
{
ff();
return 0;
}
This works:
void ff(int, int, int = 7);
void ff(int , int = 6, int = 7);
void ff(int = 5, int = 6, int = 7);
As does this:
void ff(int = 5, int = 6, int = 7);
void ff(int, int = 6, int = 7);
void ff(int, int, int = 7);
In both cases, what is remembered is
void ff(int = 5, int = 6, int = 7);
It is terribly confusing to see
void ff(int , int = 6, int);
so I did not have the compiler recognize it.
Michael