Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
maccard
on March 7, 2017
|
parent
|
context
|
favorite
| on:
Zcoin implementation bug enabled attacker to creat...
I'm not advocating writing any code like this, but you can have an overloaded == operator that _does_ have side effects, e.g. [0]
[0]
https://ideone.com/eJgiN9
Sanddancer
on March 7, 2017
[–]
It gets more fun when you're dealing with things like memory mapped I/O, where reading from a register is a destructive action, so even a non-overloaded == can cause side effects.
WalterBright
on March 7, 2017
|
parent
[–]
That's what volatile reads are for - they indicate a side effect.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
[0] https://ideone.com/eJgiN9