Re: [Dev-C++] clrscr() and c99 compatibility
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-09-25 12:21:31
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of dev...@li...
> Sent: Tuesday, September 24, 2002 10:00 PM
> To: dev...@li...
> Subject: Dev-cpp-users digest, Vol 1 #986 - 4 msgs
>
> Message: 3
> Date: Tue, 24 Sep 2002 16:36:15 +0200
> To: Dev...@li...
> From: metalseb <met...@fr...>
> Subject: Re: [Dev-C++] clrscr() and c99 compatibility
> Reply-To: met...@fr...
>
> Good afternoon Matthew
>
> >Code snippet: This happened several times with me, so I'm
> quite interested
> >to find out the reason why.
> >
> >sample code:
> >
> >void log_in(void)
> >{
> > clrscr();
> > printf("User login: ");
> > char login[80];
> > gets(login);
> > int c;
> > c = atoi(login);
> > if (c != 0 || c != 1 || c != 2) {
> > clrscr();
> > printf("Invalid login.");
> > for (;;) {
> > if (kbhit()) break;
> > }
> > }
> >}
> >
> >And it would give me a parsing error at "char login[80]" every time.
> >What's up?
>
> I tried it on my DevCpp 4.9.4.1 package and it gave me no
> compiling errors. And I really can't
> see why this should gave you errors at compile time.
>
> Kind regards
>
> --
> Seb
I had problems with the mailing list for days so i missed the
discussion. However clrscr(), kbhit() are not ANSI/ISO C and the
definition of char login[80] in that place is only possible to
C99/C++98. The default for MINGW is C90 though. You must use the std=c99
switch to make it C99.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
|