POV-Ray : Newsgroups : povray.off-topic : Job Interview : Re: Job Interview Server Time
29 Jul 2024 06:16:05 EDT (-0400)
  Re: Job Interview  
From: Warp
Date: 4 Mar 2012 17:33:56
Message: <4f53edd4@news.povray.org>
John VanSickle <evi### [at] kosherhotmailcom> wrote:
> Evidently not.  In chatting with the interviewers that day, they all 
> confirmed that most bugs are stupid things like this.

  Sadly, the vast majority of people programming in C (or C++) professionally
out there don't actually know the language enough to avoid such trivial ways
to shoot yourself in the foot. It may be something that you and me can spot
in a second, but I'm certain the average professional C programmer can't see
it. It's no wonder programs are so buggy. A sad state of affairs.

  In C++ in particular this is another situation were the majority of C++
programmers out there have no idea what's wrong:

//-------------------------------------------------------------
template<typename Value_t>
class Array
{
    Value_t* mData;
    std::size_t mSize;

 public:
    Array(std::size_t size):
        mData(new Value_t[size]),
        mSize(size)
    {}

    ~Array() { delete[] mData; }

    Value_t& operator[](std::size_t index)
    {
        assert(index < mSize);
        return mData[index];
    }

    const Value_t& operator[](std::size_t index) const
    {
        assert(index < mSize);
        return mData[index];
    }
};
//-------------------------------------------------------------

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.