|
|
On 04/03/2015 09:45 AM, scott wrote:
> An interesting read, so it turns out you are actually quite good at C#
> programming then :-)
Well, yeah, I did just spend the last 2 years writing C# code every
single day. ;-)
C++, however, still scares me a little bit. For example, consider the
following:
std::stringstream buf(user_data);
buf >> file_offset;
...yeah, it turns out file_offset was declared as a 32-bit integer
rather than a 64-bit integer. (Because C doesn't define the size of
things, it's just left as implementation-dependent. Yay!)
Now you would *think* that if the file size doesn't fit into an integer,
one of two things would happen:
1. It's C. Ignore the problem and return garbage data.
2. It's C++. Throw an exception to say something went wrong.
Naturally, C++ *actually* does neither of these. Instead, it silently
*does nothing*. As in, file_offset is left uninitialised, with garbage
data in it. Apparently there's some hidden field that none of us knew
about that you're supposed to remember to manually check for errors.
After every single conversion operation. (Because *that* isn't
error-prone at all...)
> I bet you not many applicants for *any* programming
> jobs could manage what you've described here.
Uh... from what I've seen, most applicants can't implement FizzBuzz.
(Which, I remind you, is why FizzBuzz even *exists* to begin with!)
Anyway, before you worship me too greatly, let's see if the code my
program produces actually *runs! ;-) It's fine spitting out a text file
that *looks* like it should totally work correctly. It's quite another
to actually run some unit tests and see them all pass. :-P
>> So that's easy enough. Similarly, point #6 says that I can write
>>
>> distance :: Point -> Int
>> distance (Point x y) = sqrt (x*x + y*y)
>>
>> Again, an obvious C# analogue is
>>
>> int distance(Point p)
>> {
>> return p.X*p.X + p.Y*p.Y;
>> }
>
> I think you're missing something there :-)
NAAAARHG! >_<
Sometimes I honestly wonder if I should ever have been released into the
community. Did you know, the other day I accidentally inhaled my own
saliva instead of swallowing it? How can anybody be this retarded??
Post a reply to this message
|
|