• 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!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Is C a 'good' programming language?"

Collapse

  • VectraMan
    replied
    Originally posted by d000hg View Post
    I 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++.
    I've done a load of stuff like that. C++ functions containing _asm statements to do the work. As you say MMX/SSE can make graphics operations run many times faster than you could ever acheive in a higher level language.

    Leave a comment:


  • d000hg
    replied
    Originally posted by OwlHoot View Post
    At 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.
    I 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++.

    Leave a comment:


  • VectraMan
    replied
    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);
    Spotted the difference yet?

    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.

    Leave a comment:


  • Sysman
    replied
    Originally posted by zeitghost
    Mmmmmmm...

    Hand coded 32 bit assembler

    Mmmmmmmm....
    At my first job in IT they had a clankety clank Burroughs system which unfortunately they never let me near, but they'd got good enough at it over the years to bash machine code straight onto punch cards.

    Leave a comment:


  • OwlHoot
    replied
    At 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.
    Last edited by OwlHoot; 30 August 2009, 19:58.

    Leave a comment:


  • Sysman
    replied
    Originally posted by RichardCranium View Post
    General. We're in Technical.
    WHS.

    Leave a comment:


  • Zippy
    replied
    Come on gents. Surely you can agree that you use the right tool for the particular job?

    Declared interest - C and Motorola assembly language programming person. A long time ago.

    Leave a comment:


  • RichardCranium
    replied
    Originally posted by d000hg View Post
    Since when is that in the spirit of CUK?
    General. We're in Technical.

    Leave a comment:


  • d000hg
    replied
    Originally posted by RichardCranium View Post
    Either give it rest or abuse him by PM.
    Since when is that in the spirit of CUK?

    Anyhow, maybe us 2 will have to form coalitions with DP & sy01 otherwise it's just too risky... me and C will be unable to commit fully in case DP makes an opportunistic attack from the rear.

    Leave a comment:


  • RichardCranium
    replied
    Originally posted by d000hg View Post
    blah
    Either give it rest or abuse him by PM.

    Leave a comment:


  • d000hg
    replied
    Originally posted by Churchill View Post
    It wasn't thinly veiled rudeness, my post was meant to show that not all software development is for PCs - you made an incorrect assumption and made yourself look a noddy!
    Um, no. You assumed I hadn't noticed C was used a lot in embedded systems. I may even have mentioned it earlier in the thread as it happens... the point was we were derailing onto random old-school memories and you had to jump in showing how clever you were. Or that's how it seemed.

    Btw, my feelings aren't hurt - it takes more than a drunken keyboard warrior to upset me.
    Well that's a weight off my drink-addled mind. I could barely sleep last night worrying I'd upset some geek so much he resorted to insulting my in assembly code.

    Anyway, how long shall we play this game before we and make up?

    Leave a comment:


  • Zippy
    replied
    Originally posted by Churchill View Post
    Just thought I'd let you guys know. 3 Interviews in 7 days. Blown out.

    Oh well, not meant to be!!!

    Bugger! Sorry Churchill.

    Leave a comment:


  • voodooflux
    replied
    Originally posted by Churchill View Post
    Just thought I'd let you guys know. 3 Interviews in 7 days. Blown out.

    Oh well, not meant to be!!!

    Ah bollocks, sorry to hear that chief

    Chin up, onwards n' all that.

    Leave a comment:


  • Churchill
    replied
    Originally posted by d000hg View Post
    Actually, you made the wrong assumption. I was responding to your know-it-all comment about (non)PCs/BIOS. If you're going include thinly veiled rudeness and act superior when you share knowledge, perhaps best not to bother, or at least not be surprised people call you a smartarse (do you deny it?)

    Aw, your feelings are hurt. Nevermind, I'm sure it will soon blow (goats) over.
    It wasn't thinly veiled rudeness, my post was meant to show that not all software development is for PCs - you made an incorrect assumption and made yourself look a c0ck!

    Btw, my feelings aren't hurt - it takes more than a drunken keyboard warrior to upset me.

    Leave a comment:


  • d000hg
    replied
    Originally posted by Churchill View Post
    You made the wrong assumption and also resorted to insults.
    Actually, you made the wrong assumption. I was responding to your know-it-all comment about (non)PCs/BIOS. If you're going include thinly veiled rudeness and act superior when you share knowledge, perhaps best not to bother, or at least not be surprised people call you a smartarse (do you deny it?)

    Your problem not mine. Also, the jibe about interviews, not big and certainly not clever.
    Aw, your feelings are hurt. Nevermind, I'm sure it will soon blow (goats) over.

    Leave a comment:

Working...
X