Questions tagged [reference]
A reference is a value that enables a program to indirectly access a particular datum.
51 questions
0
votes
2
answers
369
views
Why do you need to use pass by reference in C++ to change the value of the arguments inside the function?
I'm new to coding and am currently trying to learn C++ myself. I just learned about function parameters and pass by value vs pass by reference. Everywhere I read, they say that one of the reasons pass ...
2
votes
1
answer
195
views
How is $this provided in PHP?
I got a fundamental question about the $this keyword in PHP and how it is defined. Pracitcally, I know what it is and what it does. But I am interested in how it is provided / implemented?
For example,...
-2
votes
1
answer
376
views
Decoupling thirty dependencies for projects that reference each other in a sequence
I am working on a simple interface to SharePoint via Graph API. I have created a project that references Azure.Core, Azure.Identity, Microsoft.Graph, and other dependencies required to make calls via ...
1
vote
2
answers
260
views
Implementation of variables in JVM / Java
I know that a lot of interpreted higher level languages like to abstract a lot of things and therefore cannot directly be compared with lower level constructs.
For example in some languages primitive ...
4
votes
2
answers
2k
views
Reference variable vs Alias
When I started programming, I learned what Pointers are in C++. In Java, references are variables which hold the address of an object. So conceptually it's a pointer, without the ability to directly ...
7
votes
1
answer
221
views
What is the term used to describe the number of times a pointer can be dereferenced?
For example, which term completes the sentence "p has 5 ____" in order to describe a situation like int *****p?
11
votes
3
answers
3k
views
What are the pros and cons of using a reference/pointer vs an ID
I'm writing in C++, but this problem applies to any language without GC and even to languages with a GC as well.
I have a structure in memory in which I create/add objects. The structure takes ...
0
votes
1
answer
1k
views
Capture by value/reference and early/late binding
Is capture by value (x below) an early binding and capture by reference (y below) a late binding in C++ lambdas, or are they both early bindings—the first by value and the second by reference?
#...
5
votes
4
answers
2k
views
Value/reference type, object and semantics
What are the relationships between these pairs of concepts:
value/reference type;
value/reference object;
value/reference semantics?
For the first pair of concepts, it seems to me that an object of ...
8
votes
3
answers
2k
views
Pointers vs keeping indices of objects stored in a central (associative) array?
Until recently I used to think that it was preferred to reference objects by pointers or references than to keep objects in some sort of a central, authoritative array or dictionary and only keep ...
3
votes
1
answer
3k
views
C++ API design: using references vs smart pointers in a getter API
I'm trying to design an API for an object manager that registers and retrieves different related objects. When I want to retrieve an object, I can query it by its object id. I'm wondering if I should ...
7
votes
3
answers
2k
views
From a language design perspective, is the reference type in C++ mis-designed
Besides the fact that all primitive types of C++ are copy assignable except the reference type, it also doesn't play well with containers or any other parts of the language where copy-assignable ...
0
votes
2
answers
403
views
How to validate reference use?
I use "reference" term here like in C++ world, not like in C# (for example). I use non-C++ syntax on purpose -- this is general question, not about this particular implementation.
Starting something ...
1
vote
1
answer
4k
views
SQLAlchemy self referential tables explained
I encountered in a book some explanation how self referential tables in SQLAlchemy (Python) work, as an example, here is the class Employee with a manager_id:
class Employee(Base):
__tablename__ =...
1
vote
1
answer
3k
views
Object exists as long as referenced somewhere, explicit dispose not helping? [closed]
I am bit puzzled as for why this does not throw an exception - I believe the CLR does not delete the object because there is a reference to it?
static void Main(string[] args)
{
...