Talk:Machine code: Difference between revisions

no edit summary
(+ note to D entry)
No edit summary
Line 16:
===D entry===
In D, unlike in C, I have performed just a function cast on the memory of the array. Is the memory mapping used in the C entry for portability with operating systems that disallow such operation for safety?
: It is not the cast that is problematic, it's calling the function itself. Modern PCs have a feature called [http://en.wikipedia.org/wiki/NX_bit NX bit] which allows the OS to forbid execution of certain memory ranges. (A lot of other platforms have similar features as well). The general guideline tends to be that the OS forbids execution of any address unless it's known to contain executable code. Therefore, to make this example work, you need to either tell the OS that the memory you are working with should be executable, or you need to allocate new executable memory and copy the code there. Depending on your OS and its settings, your code may or may not crash without these precautions. [[User:Csaboka|Csaboka]] ([[User talk:Csaboka|talk]]) 17:19, 2 December 2014 (UTC)
Anonymous user