They're almost tweets but not... Anyway, why do Americans refer to the collective genius of Rowen Atkinson only through Mr Bean? Yeah, random today ain't they?
What is an ignored qualifier? Well, in a class, lets have a student class: #include <string> class Student { public: const std::string Name; private: bool m_Present; public: Student(const std::string& p_Name) : Name(p_Name), m_Present { } void SetPresent() { m_Present = true; } void SetAbsent() { m_Present = false; } }; Now, we may want to access the present flag, therefore provide a function to do so: bool Present() const { return m_Present } This function is telling the user of our class quite a bit, it tells them that the return type is boolean and that the calling of this function makes no changes to the class contents (const trailing the parameter list). However, for me, this isn't quite right, I believe that we want to inform any user that the boolean returned is also constant, it does not change unless you alter the internal value with the "Set
I think life mocks me at times, today I've taken delivery of a couple of things to review... The Victor Electronic Rat Killer Trap and a bunch of bait... And, I literally went to groom the guinea pigs and since this morning, I stepped into the shed and there was an immediate god awful smell. The smell of rat. But this isn't life mocking me... No, the mocking comes from the fact that the bloody test model rat trap doesn't work, and then I put the blocks of bait (which only come in a plastic bag) on top of the cage for an hour whilst I cooked tea... And when I returned the blocks and bag were gone, replaced with a set of six fat shiny fresh rat shits! So tomorrow it's WAR! The guinea pigs and rabbit are being taken out of the shed, all the storage bins (which are large plastic and covered with heavy lids) will come out, everything will be swept and the whole shed will be torn down and chopped up. All the paving slabs are coming out and being stacked... and I'm diggi
As a C++ developer I've recently been in the midst of the Exceptions debate. Exceptions as a feature of the C++ language have long divided the community, naively I've often put this down to their coming to the language from elsewhere (C perhaps) where exceptions were not the norm. This was a mistake, for in the projects I've previously worked upon the overhead of an exception compared to the ramifications of the error resulting in a crash have often totally outweighed the overhead, making deciding to employ an exception exceptionally easy (*bum bum*). Exceptions were the norm, still are and should be to you too (according to the C++ Core Guidelines https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-except ). The difficulty, the dilemma if you will, comes not from the feature, but the cost. If you application domain demands high performance you can not risk using exceptions, the argument carries on therefore whether in not using them to avoid
Comments
Post a Comment