Talk:Reference (C++)

message: "In the C++ programming language, a reference is a simple reference datatype that is less powerful but safer than the pointer type inherited from C, which is a reference in the general sense but not in the sense used by C++."  huh???? —Preceding unsigned comment added by 67.188.227.244 (talk • contribs) 07:01, 16 June 2006
:A "pointer" in C++ is a reference (computer science); but is never called that in C++. --Spoon! 08:44, 18 October 2007 (UTC)
replies: text:  This should be formulated as a definition in a less cryptic form. As it is, no beginner would even begin to understand the concept after reading the paragraph and any page on wikipedia should be accessible to all like a common encyclopedia is. Plus, one should avoid explaning a reference by saying that it is a reference datatype. This is along the lines of saying that "traffic cones are simple traffic cone thingies that can place on the road" ;) . --77.109.96.68 (talk) 00:23, 26 August 2009 (UTC)
thread_title: Untitled

message: The text states:
:a reference only becomes invalid in two cases:
::* If it refers to an object with automatic allocation which goes out of scope,
::* If it refers to an object inside a block of dynamic memory which has been freed.
Not true.
:int * x = 0 ;
:int & y = * x ;
creating a "null" reference of sorts -- its a reference to the memory at address 0 interpeted as an "int". --BostonMA talk 01:30, 17 July 2007 (UTC)
replies: text: That ought to cause a segfault on initialisation, right?  So the reference doesn't become invalid, it never becomes anything at all =)  —Preceding unsigned comment added by 81.216.240.6 (talk) 08:53, 17 October 2007 (UTC)
replies: text: Not in most compilers. Since a reference is an address and the pointer is an address, the initialization just assigns the address of the pointer to the reference (how else would you do it?); no dereferencing is needed, and hence no segmentation fault. Most compilers represent l-values (e.g. the dereferencing of a pointer) as references anyway. --Spoon! (talk) 22:48, 25 March 2008 (UTC)
thread_title:  Invalid References 

message: The article says this is the standard layout for a reference declaration:
 <Type> & <Name>
But I think the following three examples are all the same:
 int& rA = A;
 int & rA = A;
 int &rA = A;
Am I correct?
Also: I think I'd be good if the article pointed out the differences between the different uses of "&" in the context of addresses: either it is the "address-of operator" or the "reference datatype token". --Abdull (talk) 11:25, 9 February 2008 (UTC)
thread_title:  More questions 

message: I opened this article looking for information whether a reference in C++ supports polymorphism. But there is no "polymorphism" when i ctrl+f in this article.—Preceding unsigned comment added by 149.156.160.146 (talk) 09:14, 13 May 2009 (UTC)
replies: text: There isn't, but it does. As a tip, you can ask specific questions directly at the Wikipedia:Reference desk/Computing. In addition, feel free to ask specific questions directly at my talk page. decltype (talk) 09:21, 13 May 2009 (UTC)
replies: text:  Added a section, giving an example about this. I also searched for this particular information. 85.187.35.160 (talk) 19:26, 13 June 2011 (UTC)
thread_title: polymorphism

message: I have my doubts, that this analogy is valid. At least in the full sense as it is presented. If the original file is deleted, the hard link becomes the original. I don't think this is true for References. (But I don't know C++). So please correct the text or me if you know it better :)
SumedokiN (talk) 08:02, 15 December 2011 (UTC)
replies: text: Is it worth adding that a pointer has the analogy of a symbolic link in a filesystem?  — Preceding unsigned comment added by 82.32.33.183 (talk) 13:39, 7 February 2012 (UTC)
thread_title:  Hard Link Analogy 

message: This page should be updated to include a discussion of Universal References. 72.21.196.66 (talk) 12:37, 20 June 2016 (UTC)
replies: text: A potentially citable source for information: https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers 72.21.196.66 (talk) 12:37, 20 June 2016 (UTC)
thread_title:  Universal References 

message: I'm programming since about 1984 and mainly in C and C++ (for a living) but I found it hard to follow the explanations at the beginning of the article. You have to know a lot about IT technical terms and practically know what "reference" means in order to understand. Actually the word "reference" is used multiple times in order to explain "C++ reference". Yes, the reader could go upstream and read about references in general and then come back to understand the C++ case. But in my experience this practice makes Wikipedia less useful since you'll often find that the upstream article again references other parts of the related science which will force you to become a specialist in the field in order to understand anything. In some cases that might be unavoidable but here I believe that the concept of a C++ reference could be explained in a self-contained way that mainly uses normal English so that it is accessible for a wide audience and straight away. JB. --212.202.169.251 (talk) 03:00, 21 December 2023 (UTC)
thread_title:  Sorry