At the risk of starting a flame war, I disagree with you and agree with nick. If you know assembly and C++ you should be able to write C++ to produce the desired instructions. The only time I'd ever write assembly stuff is if I was doing bytecode level stuff or OS boot-strapping/device interface.
Actually I disagree a bit. :lol: Even the best compiler is not capable of always generating the optimized assembly code you desire. The problem is that optimizations are almost always done on the entire code. A super optimizing compiler would take forever to create the fastest code, and your executable could be much bigger. Only the programmer knows which functions need special attention for optimal performance, and with assembly it's easy to guarantee the results.
Access to the low level details is a bad thing IMO. The hardware is quite different to the x86 architecture, an opitmising compiler can do it better than you in 90% of the cases. Do you know how the CPU will resequence instructions to achieve parallelism? There are far more than 8 registers in a p4.
This is not true for multimedia applications. You wouldn't be able to play a DVD on your computer if it didn't use hand-optimized MMX routines (except with hardware acceleration). Sometimes it's simply necessary to use assembly to access architecture specific features. It has to be rewritten for other architectures, but that's only a small amount of work if you only optimize the few functions that really need these low-level optimizations.
Furthermore, a bit of knowledge on CPU architectures helps a lot to write faster code than a compiler, even for plain 32-bit integer code. It's true that the Pentium 4 has more than 8 registers, but it's the C++ compiler that is much more limited in using them to the fullest than most experienced assembly programmers. Almost no compiler uses MMX or SSE, and if they do, they are very bad at it.
Appart from the trivial case of I write code to work on my machine, architectures can vary and asm reduces portability and compatability.
Absolutely true, but it's often quite manageable if you're careful. Many applications are only written for one platform. I for one have never worked on anything but x86 systems (except some exotic machines at university). So if you let your C++ compiler only generate x86 assembly, there's nothing wrong with having a few x86 assembly routines. For multimedia applications, only a couple functions are really performance critical, so it pays off to write them in assembly even if you have to do it for a few architectures.
Anyway, writing logic modules in assembly, that's a waste of time. Every language, from 1st generation to 5th generation, has its purpose. Just use them wisely.