mef — 9/10/2025, 11:59:25 PM

ngl c++ is a fun language, it feels like I’m finally getting access to all the really fun programming stuff, like, am I/code.org just dumb or is explicitly passing a variable into a function by reference not a thing in java (and definitely not in js/lua)

also the fact that you can’t make read-only variables read-only in python is dumb

please let me know if I am just uneducated in the languages I’m dissing(?)

♥ 5 ↩ 0 💬 2 comments

comments

justaseacow:

explicitly passing a variable into a function by reference not a thing in java

in java functions are given a copy of the reference to an object*, while in c++ they are actually given a reference.

in short, this means argument = new Whatever(); will modify the caller’s instance in c++, but not in java

i think javascript works the same way

*except for primitives, which are always passed by value

9/11/2025, 2:42:05 AM
mef:

ok yeah, that’s what I thought, in c++ it can be either, putting DATATYPE& parameter in the function header makes it pass by reference, otherwise it passes by copy

9/11/2025, 12:51:08 PM