Is that code valid ?

Gabriel Dos Reis Gabriel.Dos-Reis@dptmaths.ens-cachan.fr
Tue Nov 11 05:30:00 GMT 1997


>>>>> «Olivier», Olivier Galibert <Olivier.Galibert@mines.u-nancy.fr> wrote:

Olivier> I'm not sure whether this should compile or not:
Olivier> QDate KfindTabDialog::string2Date(QString str)
Olivier>   {
Olivier>     int year,month,day;

Olivier>     sscanf(str,"%2d/%2d/%4d",&day,&month,&year);
Olivier>     if (QDate::isValid(year,month,day))
Olivier>         return(QDate(year,month,day));
Olivier>       else
Olivier>         return(QDate::QDate());
Olivier>   };        


Olivier> I'm actually getting:
Olivier> kftabdlg.cpp: In method `class QDate KfindTabDialog::string2Date(class QString)':
Olivier> kftabdlg.cpp:549: parse error before `;'
Olivier> kftabdlg.cpp:550: confused by earlier errors, bailing out

Olivier> Line 549 is "return(QDate::QDate());"


Olivier> Changing that line to "return QDate();" works perfectly though.

	I'am not sure this is the right place to learn C++. Anyway, if
you're intending to get an objet of class Class, you just need to say
Class(). 

-- Gaby



More information about the Gcc mailing list