Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
omoikane
on Sept 19, 2023
|
parent
|
context
|
favorite
| on:
Fixing for loops in Go 1.22
This bug appears to be because Go captures loop variables by reference, but C++ captures are by copy[1] unless user explicitly asked for reference (`&variable`). It seems like the same bug would be visually more obvious in C++.
[1]
https://eel.is/c++draft/expr.prim.lambda.capture#10
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
[1] https://eel.is/c++draft/expr.prim.lambda.capture#10