Thread View: net.lang.c++
1 messages
1 total messages
Started by Victor Milenkovic
Thu, 24 Jul 1986 13:41
C++ Bug and Fix
Author: Victor Milenkovic
Date: Thu, 24 Jul 1986 13:41
Date: Thu, 24 Jul 1986 13:41
24 lines
1179 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads