I see the code generation question have been aswered. Now for speed.
C is closer to asm than C++ and is therefore the best place to start if you think you may want to convert the code to asm. The conversion is not normaly needed as modern compilers are very good at optimizing. There is the possiblity that you could improve on the asm code produced by the compiler, but fist let it generate the code for you to examine what it has done. Also, make sure that it is being compiled as C code (not C++) or it might contain unneeded overhead.
Just wirte your assembly code as inline and make the function declaration as naked this will remove all c++ prolog and epilog to a function (like stack checking, parameter checking etc etc). if you do this then you dont have to worry what compier does.
If there's one thing I learned when I started diving into building my own compiler, it's that modern C and C++ compilers are smart. Very smart.
That said, they aren't perfect, and sometimes they'll focus optimizations on parts of your code that aren't as critical, or they'll refuse to do certain optimizations because it cannot be proven from the language definition that the optimization is safe. And, of course, they can't magically pick a better algorithm for you.
What this means in practical terms is that you shouldn't try to do premature optimizations. Write it in the language of your choice. Benchmark it. Profile it. You might just find that it's fast enough already. If not, you can find the bottlenecks and then break out the assembly.
- Mike, who has wasted entire too much time optimizing for code which wasn't a problem.
First off do not use .NET managed C++. I would program it in C++ and add assembly where needed. One case in point is if you have to do any float to int calculations do not let the compiler do that. The cpu does rounding by default and the standard states it should be truncated. So the compiler inserts over 100 asm instructions to reverse the rounding process. In a bilinear interpolation algorithm I got a factor of 10 speed up by using asm to do the conversion. Also where possible I would use MMX, and SIMD.
that's what i am kinda thinking about: writing the program in C++ under visual c++ 6, and using inline assembly to optimize where necessary for mmx/3dnow/sse. i could do that under .net using intrinsics, but i don't feel much confortable with that...
.NET is ok as long as you do not use the .NET CLR runtime. I do have one warning though. To use the mmx/3dnow/sse instructions in inline assembly on VC5 or VC6 you need the processor pack. The problem is the processor pack breaks exceptions (try() catch() blocks) in some cases and this could cause your program to crash. This is why I would recommend the VC.NET. It has builtin support for mmx/3dnow/sse.
I use the c function _getcwd to retrieve the current working directory which is almost always the directory the program is running in unless you have your working directory set differently when doing debugs in VC++.
---- "There is no try; only do or do not"
The simpilest way is to use UNICODE. There are articles at codeproject and else where on this subject. Also, if you want to develop international application you should get a copy of "Developing Internation Software for Windows...." [Microsoft Press] (a new revision of this book came out last year).
I'm developing a small application in MFC, where I need one combobox filled with two different kind of strings.
In between these two types I need a double line, like the one in MS Word Font combo box.
I've made my combo box with owner draw fixed and draw one line at the place where I required. But the line doesnt look exactly the same as in MS Word. Also my combo box is a little bigger when compared with normal combo box.
Please help me out to find a better method to develop this combo box.
what can i do in order to settle the linking errors.
and here is another question,
if i plan to call the matlab function
[features, targets] = improved_DA1(x,[cluster,0.95]);
how can i settle such kind of scenario and calling the [ ] in reference with the website tutorial method,http://www.mathworks.com/support/solutions/data/27671.shtml
I am sending a file through a WLAN card and from one pc to another. How can I save a file that have been received in the receiver PC? I don't know actually how to use VC++ to save a file in a computer either...