🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

bug in 1.0 compiler

#317
From: Bjarne Stroustrup
Date: Fri, 19 Sep 1986 00:59
29 lines
1240 bytes
> Subject: Bug in 1.0 compiler
> Path: ..!rochester!sher (David Sher @ U of Rochester, CS Dept, Rochester, NY)
> This piece of code generates incorrect C code.  The fact that
> it is incorrect C++ code is no excuse since it involves a type violation
> that cfront should catch (an (int ()) is not an int).  We have not yet
> recieved or installed the 1.1 C++ (I don't know whether we've got it yet).
> The code is thus:

#include <stream.h>
#include <stdio.h>

class foo
    {
    int cat;
public:
    foo( int x , int y ) { cat = x + y; }
    const int sile() { return sile; }
    };

main()
    {
    foo x(1,7);
    cout << x.sile();
    }

Sorry, fixed in 1.1:

"b.c", line 9: error: bad return value type for foo::sile(): const int foo::()  ( const int  expected)
Technical Details
Message-ID: <6086@alice.uUCp>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!clyde!burl!ulysses!allegra!alice!bs

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!caip!clyde!burl!ulysses!allegra!alice!bs
From: bs@alice.UucP (Bjarne Stroustrup)
Newsgroups: net.lang.c++
Subject: bug in 1.0 compiler
Message-ID: <6086@alice.uUCp>
Date: Thu, 18-Sep-86 20:59:28 EDT
Article-I.D.: alice.6086
Posted: Thu Sep 18 20:59:28 1986
Date-Received: Sat, 20-Sep-86 00:34:25 EDT
Organization: Bell Labs, Murray Hill
Lines: 28