This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

New gcc-4 compile error w/getc and isspace


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


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