delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/08/23:44:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Vin Shelton <acs AT xemacs DOT org>
Subject: New gcc-4 compile error w/getc and isspace
Date: Sun, 08 Nov 2009 23:43:41 -0500
Lines: 48
Message-ID: <hd86m0$73i$1@ger.gmane.org>
Mime-Version: 1.0
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019