This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
loop bug using mingw3.2 and cygwin in M$ Windows
- From: Gerald Lafreniere <spingoogl at shaw dot ca>
- To: gnu-gcc-bug at moderators dot isc dot org
- Date: Sat, 07 Aug 2004 04:01:07 +0000 (GMT)
- Subject: loop bug using mingw3.2 and cygwin in M$ Windows
- Newsgroups: gnu.gcc.bug
- Organization: Shaw Residential Internet
I think that maybe I should post this to bugzilla, but I think I'll post
it here first to see if anyone has
any other suggestions.
I am guessing this to be an OS problem, or the enter after the selection
is causing it. I have
tried it in cygwin, mingw3.2, and mingw2.x. I have also tried it in C++
with cin >> varfoo;
and it glides right over that one too. I am pretty fresh at
programming, and
I am still getting my feet wet in newsgroups too.
Thanks for any insight,
Gerald Lafreniere
aka spingoogL
Running this code you will produce the bug if you input anything other
than 1 2 3 or 4
system("gcc -v");
Using built-in specs.
Configured with: ../gcc/configure --with-g
mingw32 --target=mingw32 --prefix=/mingw -
-languages=f77,c++,objc,ada --disable-win3
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
Using Bloodshed's Dev-Cpp front-end.
OS is Win2K and WinXP
(*** CODE STARTS BELOW ***)
#include <stdio.h>
int DoMenu(void);
int main(void)
{
int i='\0';
i=DoMenu();
printf("\n%c\n", i);
system("Pause");
return 0;
}
int DoMenu(void)
{
int loop=1;
int c;
while (loop){
printf("\nEnter a selection between 1 and 4: ");
if ( (c=getchar())>='1' && c<='4' )
return c;
else {
printf("\n\nIf you see this, then you will find\n");
printf("that the loop went twice, and skipped\n");
printf("the getchar() function.\n\n");
}
}
}