Path: utzoo!utgpu!watmath!uunet!cs.utexas.edu!sun-barr!rutgers!columbia!read.columbia.edu!kearns
From: kearns@read.columbia.edu (Steve Kearns)
Newsgroups: gnu.g++.lib.bug
Subject: Bug in File::tell
Message-ID: <6446@columbia.edu>
Date: 10 Aug 89 18:10:30 GMT
References: <8908051856.AA21241@AENEAS.MIT.EDU> <8908061131.AA01681@g.oswego.edu.Oswego.EDU>
Sender: news@columbia.edu
Reply-To: kearns@cs.columbia.edu
Distribution: gnu
Organization: Columbia University Department of Computer Science
Lines: 28



I think the following is a bug, but I wonder cause one would think it would
have been found previously.   From File.h:

inline long File::tell()
{
  failif (!is_open() || (stat = ftell(fp) < 0));
  return stat;
}

but < has tighter precedence than = , so this says


inline long File::tell()
{
  failif (!is_open() || (stat = (ftell(fp) < 0)));
  return stat;
}

which is wrong.  Right would be:


inline long File::tell()
{
  failif (!is_open() || ((stat = ftell(fp)) < 0));
  return stat;
}