Linked by Thom Holwerda on Mon 24th Sep 2012 15:07 UTC, submitted by MOS6510
General Development "I've been programming professionally for about 3 years at this point, and I've noticed some interesting patterns in other programmers I've worked with. One of the key differentiators among programmers is motivation. I'm not referring to an individual's passion to simply be successful in their career, but rather the type of work they want to pursue. The thing they want to do with computers every day, the types of problems they are interested in solving."
Permalink for comment 536415
To read all comments associated with this story, please click here.
RE[5]: Sad Truth
by phreck on Tue 25th Sep 2012 12:52 UTC in reply to "RE[4]: Sad Truth"
phreck
Member since:
2009-08-13

By your original question, this would be correct:


#include <cstdint>
#include <algorithm>

int32_t myAbs(int32_t val) {
return std::abs(val);
}

This is even more correct than my other solution, because you explicitly mention 32 bit signed integers. The datatype "int" can also be 64 bit, so your solution is not even portable.

And if you would tell me not to use "3rd-party libs" for standard-C++ functions like std::abs(), I would immediately quit the interview under the assumption that your dev-department heavily suffers the NIH-syndrome and missed the last 20 years of C++ standardization.

Reply Parent Score: 2