Originally posted by zeitghost
- 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!
Is C a 'good' programming language?
Collapse
X
Collapse
-
Behold the warranty -- the bold print giveth and the fine print taketh away. -
Just found a bug:
Code:// borked AutoInterface<T> r(reinterpret_cast<T*>(Base::RemoveTail(), true)); // fixed AutoInterface<T> r(reinterpret_cast<T*>(Base::RemoveTail()), true);
Although this is C++, it's thanks to C's stupid comma operator that this compiles. What's passed into the reinterpret_cast is not the result of the function call, but second expression (true). It happily casts true into a T* whose value is 0x00000001 with hilarious results.
(AutoInterface's constructor has an optional second parameter, so that doesn't cause an error either).
I take it back. Tis a stupid lanugage.
Last edited by VectraMan; 1 September 2009, 20:32.Will work inside IR35. Or for food.Comment
-
Originally posted by OwlHoot View PostAt my last permie position I had to write a shed load of cleanup code to remove blemishes etc from signature image thumbnails for a building society (actually a shareholder vote for privatization).
I started out writing it in C, but as there were half a million of the brutes, which all had to be tarted up by a certain date, performance was imperative and we worked out that at the rate the code was chugging through them it would never be done in time.
So I started embedding assembler bit blitters into the code, small sections at first but of course getting more ambitious as time went on, and sure enough it started speeding up significantly.
At the same time, I was writing an Intel disassembler as a personal hobby, and so had a pretty intimate knowledge of all the prefix codes that specify a 32-bit operand etc, and I found that using these operands speeded things up even more.
In the end, the 16-bit C code went like the clappers, but was a mere shell and comprised mostly hundreds of lines of 32-bit assembler much of it hand-coded using numeric values (as the 16-bit compiler didn't support 32-bit).
When I was due to leave, to start my first contract, my magager asked the project leader about this code, and the project leader assured him it would be no problem as it was C. Although I had mentioned the assembler, he luckily had no conception of the untold horrors awaiting anyone who ventured to change it.Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishingComment
-
Originally posted by d000hg View PostI guess these days, that might be one task you could still hand-write assembly... the difference being you would be hand-crafting the SSE/MMX to parallelise it, image data being friendly in this regard. It's quite a fun area to play with IMO, especially since modern compilers (some anyway) expose intrinsics to use ASM ops directly from C++.Will work inside IR35. Or for food.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
Contractor Services
CUK News
- Business Asset Disposal Relief changes in April 2025: Q&A Yesterday 09:37
- How debt transfer rules will hit umbrella companies in 2026 Nov 12 09:28
- IT contractor demand floundering despite Autumn Budget 2024 Nov 11 09:30
- An IR35 bill of £19m for National Resources Wales may be just the tip of its iceberg Nov 7 09:20
- Micro-entity accounts: Overview, and how to file with HMRC Nov 6 09:27
- Will HMRC’s 9% interest rate bully you into submission? Nov 5 09:10
- Business Account with ANNA Money Nov 1 15:51
- Autumn Budget 2024: Reeves raids contractor take-home pay Oct 31 14:11
- How Autumn Budget 2024 affects homes, property and mortgages Oct 31 09:23
- Autumn Budget 2024: Reeves raids contractor take-home pay Oct 31 09:20
Comment