🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Mike Lijewski Fri, 15 Sep 1989 16:40
default initializers
#425
Author: Mike Lijewski
Date: Fri, 15 Sep 1989 16:40
46 lines
1835 bytes
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  14850
default initializers
#437
Author: Michael Tiemann
Date: Tue, 19 Sep 1989 17:13
57 lines
1726 bytes
   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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads