🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #270

C++ Bug and Fix

#270
From: Victor Milenkovic
Date: Thu, 24 Jul 1986 13:41
24 lines
1179 bytes
Version 1.0 of the C++ translator does not correctly evaluate constant
expressions involving the logical AND operator.  For example,

	int I = 0 && 1;

translates to,

	int I = 66;

The way to fix this problem (supplied to me by Bjarne Stroustrup) is to
insert a missing case statement.  In source file expr2.c, the second switch
in expr::eval() is missing ``case ANDAND:''.  The corrected portion of the
code should appear as follows:

	case AND:	return i1&i2;
 	case ANDAND:	return i1&&i2;	// This case was missing.
	case OR:	return i1|i2;

According to Bjarne, Version 1.1 also has this problem.

Victor Milenkovic		vjm@ius2.cs.cmu.edu
Computer Science
Carnegie Mellon
Pittsburgh, PA  15213
Technical Details
Message-ID: <1018@ius2.cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!ius2.cs.cmu.edu!vjm

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!ius2.cs.cmu.edu!vjm
From: vjm@ius2.cs.cmu.edu (Victor Milenkovic)
Newsgroups: net.lang.c++
Subject: C++ Bug and Fix
Message-ID: <1018@ius2.cs.cmu.edu>
Date: Thu, 24-Jul-86 09:41:48 EDT
Article-I.D.: ius2.1018
Posted: Thu Jul 24 09:41:48 1986
Date-Received: Thu, 24-Jul-86 21:38:43 EDT
Organization: Carnegie-Mellon University, CS/RI
Lines: 25