Originally posted by russell
View Post
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Code review - hilarious code snippets
Collapse
X
Collapse
-
.Net apps only run in user mode so you could argue quite legitimately that the windows runtime architecture protects you from BSOD rather than the programming environment.Knock first as I might be balancing my chakras. -
You'd have thought.Originally posted by russell View PostI doubt testing for null is an expensive operation and can probably be optimized by the compiler.
Knock first as I might be balancing my chakras.Comment
-
What happens when it 'goes bang' is that you get an exception. The point is that when it doesn't then you only execute the try block, which is quicker than checking results for null every time.Originally posted by suityou01 View PostWhat about encapsulation? You would want to take into your thoughts what happens to the caller if this goes bang? Using a try block with no exception being raised sounds dodgy IMVHO, and runs the risk of creating time bombs.
Just sayin like
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'Comment
-
There was a chap kicked out of the aerospace place I was at, it was all rather basic C. As you may imagine, aircraft software has to be very carefully controlled and you do only what is absolutely necessary according to the design spec but he was modding unrelated modules because he didn't like some name or whatever.bloggoth
If everything isn't black and white, I say, 'Why the hell not?'
John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)Comment
-
Probably because the compiler won't let you write a try with no catchOriginally posted by eek View PostThat wasn't what he was saying. Its the cost of testing for null all the time compared to using a try block with an exception. I don't think anyone has suggested using a try block with no exception (until you arrived).While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'Comment
-
Originally posted by doodab View PostWhat happens when it 'goes bang' is that you get an exception. The point is that when it doesn't then you only execute the try block, which is quicker than checking results for null every time.
unhandled exception
Knock first as I might be balancing my chakras.Comment
-
Originally posted by doodab View PostTesting for a null result is more expensive than a try block if no exception is raisedOriginally posted by suityou01 View PostPost 44, paragraph 1, sentence 2, clause 1.
HTH BIDI
Is not suggesting you create a try block with no exception capture its a statement on whether a try block is more expansive than testing for a null result.
merely at clientco for the entertainmentComment
-
But it will let you write an empty catch. Hence "raising a try without raising an exception" made me raise my eyebrows.Originally posted by doodab View PostProbably because the compiler won't let you write a try with no catch
Knock first as I might be balancing my chakras.Comment
-
And again in EnglishOriginally posted by eek View Post
Is not suggesting you create a try block with no exception capture its a statement on whether a try block is more expansive than testing for a null result.
Knock first as I might be balancing my chakras.Comment
-
Exceptions should only be used for situations that you cannot foresee i.e. A external resource not being available, not for an empty search result from a query, the clue is in the name.Originally posted by eek View Post
Is not suggesting you create a try block with no exception capture its a statement on whether a try block is more expansive than testing for a null result.Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers

Comment