All Questions

1894
votes
22answers
854385 views

How do I pass a variable by reference?

The Python documentation seems unclear about whether parameters are passed by reference or value, and the following code produces the unchanged value 'Original' class PassByReference: def __init_...
2387
votes
31answers
733178 views

What are the differences between a pointer variable and a reference variable in C++?

I know references are syntactic sugar, so code is easier to read and write. But what are the differences? Summary from answers and links below: A pointer can be re-assigned any number of times w...
455
votes
14answers
202040 views

Is there a difference between `==` and `is` in Python?

My Google-fu has failed me. In Python, are the following two tests for equality equivalent (ha!)? n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' Does this h...
101
votes
6answers
46509 views

How does the Windows Command Interpreter (CMD.EXE) parse scripts?

I ran into ss64.com which provides good help regarding how to write batch scripts that the Windows Command Interpreter will run. However, I have been unable to find a good explanation of the grammar ...
282
votes
4answers
204224 views

Javascript by reference vs. by value

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 wh...
180
votes
11answers
60272 views

How come a non-const reference cannot bind to a temporary object?

Why is it not allowed to get non-const reference to a temporary object, which function getx() returns? Clearly, this is prohibited by C++ Standard but I am interested in the purpose of such restrict...
247
votes
9answers
97945 views

Does Javascript pass by reference?

Does Javascript pass by references or pass by values? Here is an example from Javascript: The Good Parts. I am very confused about my parameter for the rectangle function. It is actually undefined, an...
78
votes
6answers
151609 views

Strict Standards: Only variables should be passed by reference

$el = array_shift($instance->find(..)) The above code somehow reports the strict standars warning,but this will not: function get_arr(){ return array(1,2); } $el = array_shift(get_arr()); ...
374
votes
9answers
104664 views

MongoDB relationships: embed or reference?

I'm new to MongoDB--coming from a relational database background. I want to design a question structure with some comments, but I don't know which relationship to use for comments: embed or reference?...
62
votes
5answers
21577 views

What is the difference between a variable, object, and reference?

Exactly what are the differences between variables, objects, and references? For example: they all point to some type, and they must all hold values (unless of course you have the temporary null-able...

Previous Next