Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [reference]

A reference is a value that enables a program to indirectly access a particular datum, such as a variable or a record, in the computer's memory or in some other storage device.

3922 votes
44 answers
1.3m views

What are the differences between a pointer variable and a reference variable?

What is the difference between a pointer variable and a reference variable?
prakash's user avatar
  • 59.5k
3315 votes
42 answers
2.1m views

How do I pass a variable by reference?

I wrote this class for testing: class PassByReference: def __init__(self): self.variable = 'Original' self.change(self.variable) print(self.variable) def change(self, ...
David Sykes's user avatar
  • 49.4k
1490 votes
23 answers
1.2m views

How to copy a dictionary and only edit the copy

I set dict2 = dict1. When I edit dict2, the original dict1 also changes. How can I avoid this? >>> dict1 = {"key1": "value1", "key2": "value2"} >>...
MadSc13ntist's user avatar
1028 votes
28 answers
443k views

What's the difference between the 'ref' and 'out' keywords?

I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between: public void myFunction(ref MyClass someClass) and public void ...
TK.'s user avatar
  • 47.5k
921 votes
62 answers
1.4m views

The located assembly's manifest definition does not match the assembly reference

I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error: System.IO.FileLoadException: Could not load file or assembly 'Utility, ...
leora's user avatar
  • 194k
917 votes
12 answers
258k views

What's the difference between SoftReference and WeakReference in Java?

What's the difference between java.lang.ref.WeakReference and java.lang.ref.SoftReference ?
driekken's user avatar
  • 11.6k
638 votes
10 answers
246k views

MongoDB relationships: embed or reference?

I want to design a question structure with some comments. Which relationship should I use for comments: embed or reference? A question with some comments, like stackoverflow, would have a structure ...
Freewind's user avatar
  • 197k
628 votes
13 answers
540k views

Is there a difference between "==" and "is"?

My Google-fu has failed me. In Python, are the following two tests for equality equivalent? n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' Does this hold ...
Bernard's user avatar
  • 45.5k
533 votes
16 answers
1.1m views

The type or namespace name could not be found [duplicate]

I have a C# solution with several projects in Visual Studio 2010. One is a test project (I'll call it "PrjTest"), the other is a Windows Forms Application project (I'll call it "PrjForm"). There is ...
Anders's user avatar
  • 15.4k
485 votes
13 answers
292k views

Does JavaScript pass by reference? [duplicate]

Does JavaScript pass by references or pass by values? Here is an example from JavaScript: The Good Parts. I am very confused about the my parameter for the rectangle function. It is actually undefined,...
J Any's user avatar
  • 4,997
466 votes
17 answers
253k views

When should I use pointers instead of references in API-design?

I understand the syntax and general semantics of pointers versus references, but how should I decide when it is more-or-less appropriate to use references or pointers in an API? Naturally some ...
connec's user avatar
  • 7,391
459 votes
11 answers
279k views

Why can't I make a vector of references?

When I do this: std::vector<int> hello; Everything works great. However, when I make it a vector of references instead: std::vector<int &> hello; I get horrible errors like ...
Colen's user avatar
  • 13.7k
435 votes
4 answers
65k views

Why can't I store a value and a reference to that value in the same struct?

I have a value and I want to store that value and a reference to something inside that value in my own type: struct Thing { count: u32, } struct Combined<'a>(Thing, &'a u32); fn ...
Shepmaster's user avatar
  • 420k
424 votes
4 answers
349k views

JavaScript by reference vs. by value [duplicate]

I'm looking for some good comprehensive reading material on when JavaScript passes something by value and when by reference and when modifying a passed item affects the value outside a function and ...
jfriend00's user avatar
  • 701k
416 votes
1 answer
53k views

Why does the Rust compiler not optimize code assuming that two mutable references cannot alias?

As far as I know, reference/pointer aliasing can hinder the compiler's ability to generate optimized code, since they must ensure the generated binary behaves correctly in the case where the two ...
Zhiyao's user avatar
  • 4,324

15 30 50 per page
1
2 3 4 5
1153