🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9260

references - C++

#9260
From: Bjarne Stroustrup
Date: Sat, 06 Sep 1986 01:36
16 lines
1163 bytes
Karl W. Z. Heuer writes:

> BMS-AT!stuart writes:
> >[re the declaration of reference types "foo(char &c)"]
> >I don't like this.  It violates the nice consistent way that C expressions
> >work.  'char *c' means that '*c' is of type char.  '&c' is not of type
> >char in any other context.
>
> I am also somewhat uneasy about calling it "char &c".  The consistent way to
> declare it would be "char *&c", since you have to write "&c" to get ahold of
> the "char *" object you are really using.

The notation T& is the C++ notation for a reference to an object of type T.
	char& c;	declares c to be a reference to a char
	char*& r;	declares r to be a reference to a char*
& is a declarator operator exactly like *
Technical Details
Message-ID: <6023@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: references - C++
Message-ID: <6023@alice.uUCp>
Date: Fri, 5-Sep-86 21:36:18 EDT
Article-I.D.: alice.6023
Posted: Fri Sep  5 21:36:18 1986
Date-Received: Sat, 6-Sep-86 20:24:50 EDT
Organization: Bell Labs, Murray Hill
Lines: 16