New gcc-4 compile error w/getc and isspace

Vin Shelton acs@xemacs.org
Mon Nov 9 04:47:00 GMT 2009


Consider this module:

#include <stdio.h>
#include <ctype.h>

void
tst(FILE *fp)
{
   int c;

   while ( isspace(c = getc(fp)) )
     ;

   return;
}

gcc-4 -c t2.c
t2.c: In function ‘tst’:
t2.c:9: error: lvalue required as left operand of assignment

I'm pretty sure this module used to compile successfully under gcc-4, 
but I recently rebuilt my machine, so something may have changed in the 
configuration.

gcc-3 compiles the module without complaint.

gcc-4 will compile this version:

#include <stdio.h>
#include <ctype.h>

void
tst(FILE *fp)
{
   int c;

   //while ( isspace(c = getc(fp)) )
   while ( c = getc(fp) && isspace(c) )
     ;

   return;
}

Did something recently change in the ctype.h or stdio.h header files to 
cause this?

Regards,
   Vin


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list