🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: C++ on existing C programs.

#287
From: karl
Date: Sat, 16 Aug 1986 20:56
19 lines
1525 bytes
dcl-cs!stephen writes:
>C++ is supposed to be upwards compatible with C.  Can anybody, therefore,
>explain why the following does not compile (under 4.2):
[irrelevant portions deleted --karl]
># include <grp.h>
>int    fd = -1, wizard, group, ngroups = NGROUPS, goodguy, glist [NGROUPS];

Because <grp.h> declares "struct group", and line 25 declares "int group".
In C++, class names share the same namespace as variables -- there is, in
effect, an automatic declaration "typedef struct group group".  I think there
might be a compatibility flag to allow the collision.

In future, you might try isolating the problem by deleting chunks of code
until you have a minimal-case program that demonstrates the alleged bug.  It
makes it easier to convince the Powers That Be if it is a compiler bug, or
to find it yourself if it isn't.

Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint
Technical Details
Message-ID: <165200001@haddock>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ima!haddock!karl
References: <350@comp.lancs.ac.uk>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site haddock
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ima!haddock!karl
From: karl@haddock
Newsgroups: net.lang.c++
Subject: Re: C++ on existing C programs.
Message-ID: <165200001@haddock>
Date: Sat, 16-Aug-86 16:56:00 EDT
Article-I.D.: haddock.165200001
Posted: Sat Aug 16 16:56:00 1986
Date-Received: Tue, 19-Aug-86 08:08:53 EDT
References: <350@comp.lancs.ac.uk>
Lines: 19
Nf-ID: #R:comp.lancs.ac.uk:350:haddock:165200001:000:891
Nf-From: haddock!karl    Aug 16 16:56:00 1986