There are times it would be good to be able to write assembly code to
integrate with other VS languages, such as VS C++ .NET. For example, I might
want to write a REALLY fast algorithm that does CALCULATIONS only and
bypasses any overhead imposed by the compiler.
Is inline assembly still possible? Wouldn't a Visual Assembler language make
some sense (although the 'visual' is only to imply compatibility and
seemless integration into other Visual languages)?
Ben Voigt [C++ MVP] - 19 Dec 2007 22:25 GMT
> There are times it would be good to be able to write assembly code to
> integrate with other VS languages, such as VS C++ .NET. For example, I
[quoted text clipped - 4 lines]
> make some sense (although the 'visual' is only to imply compatibility and
> seemless integration into other Visual languages)?
I'm pretty sure x86 inline assembler is still alive and kicking in the
latest VC++, although I seem to remember that x86_64 might not be. I'd also
think that inline assembly now recognizes more instructions than ever
before.
However, you're better off writing very simple C code (register transfer
style) and let the optimizer run, it will probably generate better machine
code than you. Humans can keep track of register spills pretty effectively
but when you add pipelining, branch prediction, cache associativity, and a
whole bunch of other factors, instruction costs are not constant and there's
no way a programmer can optimize them all in a reasonable amount of time.
r norman - 19 Dec 2007 23:57 GMT
>> There are times it would be good to be able to write assembly code to
>> integrate with other VS languages, such as VS C++ .NET. For example, I
[quoted text clipped - 16 lines]
>whole bunch of other factors, instruction costs are not constant and there's
>no way a programmer can optimize them all in a reasonable amount of time.
It is also often true that spending the same time working on the
design of the program data flow and algorithms yields far better
improvements that trying to hand craft assembler code.
Besides, "real men" don't need Visual tools. Edlin is good enough for
us!
Larry Smith - 20 Dec 2007 01:41 GMT
> Edlin is good enough for us!
Only if you're a glutton for punishment.
Ben Voigt [C++ MVP] - 20 Dec 2007 14:58 GMT
>> Edlin is good enough for us!
>
> Only if you're a glutton for punishment.
True, but vim is good enough, and it's not really any less arcane.
Kerem Gümrükcü - 20 Dec 2007 15:19 GMT
I LOVE vim, the best editor in the world!
Regards
Kerem

Signature
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Larry Smith - 20 Dec 2007 15:32 GMT
>>> Edlin is good enough for us!
>>
>> Only if you're a glutton for punishment.
>
> True, but vim is good enough, and it's not really any less arcane.
I was a fan of "Brief" myself many moons ago but I understand there's a Vim
plugin that can emulate it.
Tamas Demjen - 21 Dec 2007 17:50 GMT
> Edlin is good enough for us!
Theoretically we only need a keyboard with two buttons: 0 and 1, and we
could enter machine code directly that way.
Tom
Ben Voigt [C++ MVP] - 24 Dec 2007 15:50 GMT
>> Edlin is good enough for us!
>
> Theoretically we only need a keyboard with two buttons: 0 and 1, and we
> could enter machine code directly that way.
Any telegraph operator will tell you that a single button is sufficient
(thanks to Samuel Morse).
> Tom
Bo Persson - 20 Dec 2007 16:59 GMT
:: There are times it would be good to be able to write assembly code
:: to integrate with other VS languages, such as VS C++ .NET. For
[quoted text clipped - 6 lines]
:: compatibility and seemless integration into other Visual
:: languages)?
If you have the full package - Professional Edition - VS does include
an assembler. Just add a .asm file to your project and compile!
It is just that hardly anybody uses it, because it is *extremely* hard
to outsmart the compiler. If you can shave more than one or two asm
instructions from a compiled function, you are at the Guru level !
Bo Persson
Ben Voigt [C++ MVP] - 20 Dec 2007 18:05 GMT
> :: There are times it would be good to be able to write assembly code
> :: to integrate with other VS languages, such as VS C++ .NET. For
[quoted text clipped - 13 lines]
> outsmart the compiler. If you can shave more than one or two asm
> instructions from a compiled function, you are at the Guru level !
It's easy to shave *instructions*. But fewer instructions doesn't mean
smaller or faster code. And while the size of each instruction can be
known, the speed is dependent on far too many factors to consider by hand.
> Bo Persson
Shadowman - 21 Dec 2007 20:45 GMT
> There are times it would be good to be able to write assembly code to
> integrate with other VS languages, such as VS C++ .NET. For example, I might
[quoted text clipped - 4 lines]
> some sense (although the 'visual' is only to imply compatibility and
> seemless integration into other Visual languages)?
Roughly speaking, you want something like:
int main() {
//c++ code
__asm {
//inline assembly code
}
}
Check out the msdn pages on it, for something authoritative:
http://msdn2.microsoft.com/en-us/library/45yd4tzz.aspx

Signature
SM
rot13 for email
Jordi Maycas - 14 Jan 2008 14:47 GMT
You could make a program like,
int main()
{
asm mov eax,2
asm mov ebx,4
asm add eax,ebx
asm cmp eax,5
asm je ok
no:
ok:
return 0;
}
>> There are times it would be good to be able to write assembly code to
>> integrate with other VS languages, such as VS C++ .NET. For example, I
[quoted text clipped - 17 lines]
> Check out the msdn pages on it, for something authoritative:
> http://msdn2.microsoft.com/en-us/library/45yd4tzz.aspx