Showing posts with label Core. Show all posts
Showing posts with label Core. Show all posts

Friday, 18 January 2019

C++: The Dilemma of using Exceptions

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 that overhead in performance you are actually cutting off your nose to spite your face... What are the downstream costs if an unexpected, in tested for, error occurs and some strange behavior ensues, or worse it propagates up and out of your application to crash?!!

In the modern era of social media such feedback is near instantaneous, can you afford the egg on face?

And so you spin yourself around and dig further into the ground your problems.

Voices from industry do little to alleviate the problem, google for instance (https://google.github.io/styleguide/cppguide.html#Exceptions), almost seem to advocate using exceptions if from the ground up you can build them in.  You stand the cost of retraining developers and change your ways of working around (e.g. embrace RAII).

They even go so far as to state "the benefits of exceptions outweigh the costs", but then add the caveat "in new projects".  How old or new your project should not define your error handling mechanisms, surely?  Plus from experience I've always found a code base is as old or new as the minds working upon it.  If you have an engineer firmly rooted in C without exceptions they will continue to churn code in that style through your compiler (which will happily work with it), not because it's a better way of working nor because it's a worse way of working, quite often it's continued along simply under the inertia of experience that developer has and they've not time to stop to take stock.

Even given that time, which the project I've just begun working upon has, there's weight behind the past, the old way of working, what worked before, and if that was non-exception handling code people stick with it.  Tell those self same people "you really should use these, oh and you have to retrain your minds, plus it'll take longer to compile and more time to run" they're going to stare at you like you're mental.


The question I'm left with is therefore not whether to use exceptions or not (well I am left with this problem, and this post is no help) instead we're left with the question of when will the benefits of exceptions, their ease of use, simplicity to write and visualise out weight the retraining, compile time and runtime costs?... I don't think that's anytime soon, it should be after so many years, but it's simply not.

x

Saturday, 12 January 2013

Asus P6X58D-E Failed

I've checked my machine out now, and I've come to the conclusion that all the peripherals in this machine work fine else where its down to the Motherboard.

The machine will boot, one time in one hundred, so the CPU is working it lets me boot into a live Linux CD and even boot Vista, if it boots, and its during these other ninety nine attempts to boot that the problems come along.

The problem is this, turn the power on, hit the power button (on the motherboard or on the case) and the PSU will spring to life the CPU Cooler and the Graphics card fan, all these fans spin at maximum speed, and that's it...

No BIOS, no POST, nothing... Even with a speaker attached, nothing, no beeps, nothing.

Now, this usually indicates a dead PSU, but I've tried the it in another of my machines, and its fine!

Even if I remove all the RAM, which is meant to give long beeps in sequence, the motherboard doesn't squeek, nothing, it just sits there and blank black max fan time.

The problem I have now is I need to get service on it, this thing cost me £143 on December 2010.  That's two years one month.  It gets from Asus a 3 years warranty, so I should be covered, Asus however have told me to get hold of the retailer, the retailer have yet to reply - I bet they want me to use their 60p a second help line and sit on hold for an hour.

The rub though is, even if they do try to help, or I get an RMA... my CPU is a socket 1366, its not going to just randomly fit another motherboard and 1366 boards are getting very rare on the market (for reasons which I've had no interest in, but am now trying to fathom out).  I have literally just sent missives to the retailer for assistance, I can at least prove my warranty started on the 11th November 2010, and hence is within the mandated 3 years by Asus.

And there's another problem, Asus state a 3 year warranty, but they say to contact the retailer about it?

I'll let you know how I get along.

Galant Ikea Desk
The other battle I'm fighting is about my desk, I lowered my desk last night, but one of the legs felt dead loose, you can unscrew the legs and they let you telescope them in and out, well one of them just feels all floppy and will not tighten back up.

I'm a little worried about this, but tomorrow sometime I hope to get all the crap off of the desk and to put all the legs right and level.