News for hackers. Stuff that matters.
Re:Making a Go program 70% faster with a one character change by brundolf on Monday November 14, 2022 @01:44PM (#33598844)
Having used C++ relatively little, and a long time ago (and never used Go), I don't think I ever realized that value semantics could be used to implicitly clone heap objects

Yeesh

Re:Making a Go program 70% faster with a one character change by masklinn on Monday November 14, 2022 @02:16PM (#33599358)
Normally they’re not, that’s really specific to C++ nonsense.

In a normal value-semantics system if you have a pointer you just copy the pointer. Obviously if the langage doesn’t have your back it also means you’ve now fucked up your ownership, but you’re in C so that was to be expected.

Re:Making a Go program 70% faster with a one character change by brundolf on Monday November 14, 2022 @02:19PM (#33599409)
Yeah, this was my assumption when I read the original comment, so I was confused about what it was saying (I thought it was suggesting you should pass references instead of doing a bitwise-copy most of the time, which is just plausible enough that I believed it for a minute) until I read further down in the thread and realized they meant implicit heap-cloning