Thread View: comp.std.c++
4 messages
4 total messages
Started by Daniel R. Edelson
Fri, 06 Nov 1992 22:50
Unitialized dynamic reference
Author: Daniel R. Edelson
Date: Fri, 06 Nov 1992 22:50
Date: Fri, 06 Nov 1992 22:50
16 lines
823 bytes
823 bytes
The draft standard has the following to say about references: ``The declaraion of a reference must contain an initializer except when the declaration contains an explicit extern specifier, is a class member, declaration within a class declaration, or is the declaration of an argument or return type.'' So, given that, is the following illegal? new (int&) All the compilers I tried permitted it. Thanks, Daniel Edelson
Re: Unitialized dynamic reference
Author: Brian McCauley
Date: Sat, 07 Nov 1992 16:06
Date: Sat, 07 Nov 1992 16:06
17 lines
1028 bytes
1028 bytes
In article <1dessbINNn1b@darkstar.UCSC.EDU>, daniel@cse.ucsc.edu (Daniel R. Edelson) writes:
> ... is the following illegal?
>
> new (int&)
Yes the type of this expression is `int&*'. There is no such type!
(Because if you try to take the address of reference what you get is the
address of the thing referred to.)
> All the compilers I tried permitted it.
Get some better compilers - Borland 3.1 spotted the error.
\\ ( ) NO BULLSHIT! from BAM (Brian McCauley)
. _\\__[oo ============
.__/ \\ /\@
. l___\\ E-mail: B.A.McCauley@bham.ac.uk
# ll l\\
###LL LL\\
Re: Unitialized dynamic reference
Author: Daniel R. Edelson
Date: Sat, 07 Nov 1992 17:29
Date: Sat, 07 Nov 1992 17:29
17 lines
1230 bytes
1230 bytes
In article <1992Nov7.160634.1@vax1.bham.ac.uk> mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes: >In article <1dessbINNn1b@darkstar.UCSC.EDU>, daniel@cse.ucsc.edu (Daniel R. Edelson) writes: >> ... is the following illegal? >> >> new (int&) >Yes the type of this expression is `int&*'. There is no such type! >(Because if you try to take the address of reference what you get is the >address of the thing referred to.) This could conceivably be interpreted as returning the address of the referent (just like taking the address of a reference), though I don't think that's a correct interpretation. My point is if this is clearly illegal, some explicit mention should perhaps be made in the draft standard. Daniel Edelson
Re: Unitialized dynamic reference
Author: John MAX Skaller
Date: Tue, 10 Nov 1992 01:31
Date: Tue, 10 Nov 1992 01:31
23 lines
1373 bytes
1373 bytes
In article <1dessbINNn1b@darkstar.UCSC.EDU> daniel@cse.ucsc.edu (Daniel R. Edelson) writes:
>
>The draft standard has the following to say about references:
>
>``The declaraion of a reference must contain an initializer except
>when the declaration contains an explicit extern specifier, is a
>class member, declaration within a class declaration, or is the
>declaration of an argument or return type.''
>
>So, given that, is the following illegal?
>
> new (int&)
>
>All the compilers I tried permitted it.
>
Wow, wonder what they allocated? IMHO: It does not make sense
to allocate a reference, only an object.
--
;----------------------------------------------------------------------
JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
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