I’d walk out. Never, ever take a job given to you for solving a riddle. Everyone else there will have gotten theirs the same way and it won’t be great.
A way to torture an interviewer (C++, FizzBuzz)
51–60 of 84 posts
Re: A way to torture an interviewer (C++, FizzBuzz)
#52If a candidate were suggesting this as their serious FizzBuzz implementation fit for production, I'd have a hard talk with them about readability.
Realistically this is an appropriate joke answer to a joke question.
Re: A way to torture an interviewer (C++, FizzBuzz)
#53Re: A way to torture an interviewer (C++, FizzBuzz)
#54Earlier quoted context omitted.
Ah, so it's the nil address?
No, it's the address past the end of the array {'\0'}.
Here's how I unpack this: ""[1] is the 0 (termination) byte. The 0 byte is then interpreted as an address -- the nil address.
But what's the use of asking for the address of the null terminator? Where is that stored exactly?
Re: A way to torture an interviewer (C++, FizzBuzz)
#55Once you have undefined behavior, you lose the ability to reason about your entire program.
Thus, this program does not solve the problem.
It demonstrates a lack of knowledge about undefined behavior in C++.
Rating: Absolutely would never hire this candidate.
Re: A way to torture an interviewer (C++, FizzBuzz)
#56Re: A way to torture an interviewer (C++, FizzBuzz)
#57Earlier quoted context omitted.
The address of the nil byte + 1
But isn't `""` 0 terminated? So the first offset past the nil byte is 0, interpreted as an address.
The code uses "" as an arbitrary address, and ""[1] as that address + 1.
This way this-"" gets you 1-based index into the array.
It assumes the compiler dedfuplicates strings, making the behavior of this program undefined.
Re: A way to torture an interviewer (C++, FizzBuzz)
#58Re: A way to torture an interviewer (C++, FizzBuzz)
#59Earlier quoted context omitted.
How much structure can a fizzbuzz have exactly?
How much structure would you like? https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
Sometimes I wonder why some dev teams take 10x longer to develop some functionality than what I would consider reasonable.
Then I see code like this.
Re: A way to torture an interviewer (C++, FizzBuzz)
#60You wouldn't torture him. You would just zero the probability of getting an offer. There's no SW house or colleague in his right mind that would want a developer that writes obfuscated and needlessly complex to understand code.
A playful response to the mind numbing idiocy of fizzbuzz.