This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is that code valid ?
- To: Olivier Galibert <Olivier dot Galibert at mines dot u-nancy dot fr>
- Subject: Is that code valid ?
- From: Gabriel Dos Reis <Gabriel dot Dos-Reis at dptmaths dot ens-cachan dot fr>
- Date: Tue, 11 Nov 1997 14:28:37 +0100 (MET)
- Cc: egcs at cygnus dot com
- References: <19971111065132.56342@renaissance.loria.fr>
>>>>> «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