Arista Networks Interview Question

Why two calls to printf with same parameters were giving completely different results?

Interview Answers

Anonymous

Oct 14, 2017

Likely the compiler/linker were resolving these calls to slightly different library functions/wrappers.

1

Anonymous

Oct 17, 2017

The format string and arguments aren't consistent, so the stack is not unwound properly. As the result, the caller's addressing (like %esp + auto variable offset) becomes irrelevant to the actual addresses and gives wrong values.