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]

Is that code valid ?


>>>>> «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


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