For Windows, it IS required. Default allocations with malloc/new don't allow code executions on them for security reasons.
To be able to execute code with that memory you need to allocate it with VirtualAlloc and PAGE_EXECUTE_READWRITE.
PAGE_EXECUTE_READ allows Code Execution.
Adding WRITE allows you to write the bytecode from the data to the memory.
For this reasons you just cannot use malloc/new who just have PAGE_READWRITE permissions.
I mentioned Windows because it's in the lounge, not in the unix-specific section, and because I don't know how to do that in Linux.
@Lumpkin I didn't understand the question, but VirtualAlloc doesn't (obviously) allow you to free/delete it, just to VirtualFree it.
And you can use VirtualAlloc to just allocate a memory chunk with PAGE_READWRITE, and it won't be executed (Crash if you try to execute codes in that location).
| why do i need my compiler to output byte code? |
Unless you want to carry a ASM compiler and deal with licensing issues, I don't suggest you to use source code. Besides, compiling an assembly file before instantly running it could be slow as hell. Compilation is not fast for every PC.
| why cant my assembly code be compiled on all operating systems? |
One OS could allow some rare instructions to be ran when another may not.
Can't tell tho, but you better compile them three times at least: Windows, Linux and Mac (If you're going to port them, otherwise just Linux could be enough).