But sometimes you just have to do it or you want to. Asmjit is a decent looking cross-platform assembler (MIT License so anything goes!) written in C++ that lets you write assembler code in C++. I.e it uses an instance of a class called Assembler so you get code like
Assembler a;
a.push(ebp) ;
a.mov(ebp, esp) ;
a.push(esi) ;
a.push(edi) ;
Label L_Exit;
a.mov(eax, dword_ptr(esi)) ;
a.mov(dword_ptr(edi), eax) ;
a.jz(&L_Exit) ;
Which is quite ingenious! It has libraries for x86 and x64 bit CPUs as well. There's also a Compiler class that lets you develop cross-platform assembler code without worrying about function calling conventions and register allocation.
- Link to C++ Code Library

