Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
WalterBright
on Sept 11, 2022
|
parent
|
context
|
favorite
| on:
Teaching C (2016)
Because foo() gets implicitly declared as accepting int arguments, when it actually accepts a double. The double bits interpreted as an int are 0.
edflsafoiewq
on Sept 11, 2022
[–]
On x64, foo(double) expects its argument in xmm0, but foo(int) expects it in rdi. So the 3 passed in rdi is ignored and it operates on whatever happened to be in xmm0.
WalterBright
on Sept 11, 2022
|
parent
[–]
Yes, you're right. Thanks for the correction. I was thinking of the Windows C ABI.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: