Post #3217667
2026-06-09 08:04 UTC
As someone who likes working with higher level languages, I never understood the pass by reference or even referencing different pointers. It never stuck out to me as useful in what I want software to do. It’s too close to hardware.
Replies (3)
-
@ZILtoid1991@lemmy.world 2026-06-09 08:37
Reference values are quite useful, such as: double valOut; if (parseDouble(valOut) == 0) { //Argument of parseDouble is ref type, no & needed for input, no exceptions needed for error handling [...] //No error, code executed normally } else { [...] //Erroreus input }
-
@lime@feddit.nu 2026-06-09 09:42
if you’re working with higher level languages you pass-by-reference all the time. give a list to a function to modify it? that’s by reference. giving an event handler function to a framework? that’s by reference. setting a property on an object? that’s usually by reference.
-
@Sylvartas@lemmy.dbzer0.com 2026-06-09 10:44
Most of the time you pass by reference for more outputs, or by const ref to avoid copying a big-ass data structure