This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-3.1 problem


On Wed, Jun 26, 2002 at 12:22:19PM +0800, Tony, Zhou Jingtao wrote:
> Doesn't the "g++" of "gcc-3.1" support "default argument"? I got an error when compiling the following program with it, while it ran fine with "gcc-3.0.4".
> 
> ----------
> StrTok.h:
> ----------
> #ifndef __STRINGTOKENIZER_H__
> #define __STRINGTOKENIZER_H__
> 
> #include <iostream>
> #include <string>
> #include <vector>
> 
> using namespace std;
> 
> class StrTok
> {
> public:
>    StrTok (string s, string delim = " ");

The above is OK.


> 
> ------------
> StrTok.cpp:
> ------------
> #include <StrTok.h>
> 
> StrTok::StrTok(string s, string delim = " ")
                           ^^^^^^^^^^^^^^^^^^     
Change this here, keep the default argument in the header file only.

  StrTok::StrTok(string s, string delim)

This was mentioned on the gcc mailing list a few weeks ago:

http://gcc.gnu.org/ml/gcc/2002-06/msg01029.html


--
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@attbi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]