In a string literal?!?! We did better almost 40 years ago..., this is assembly in turbo pascal:<p><pre><code> procedure init; assembler;
asm
mov ax,13h
int 10h
end;
</code></pre>
You can even have only the asm block in a regular pascal function and make use of regular arguments in the asm block.
Lots of languages have inline assembly. Pascal does:<p>- Free Pascal: <a href="https://www.freepascal.org/docs-html/prog/progch3.html#progse9.html" rel="nofollow">https://www.freepascal.org/docs-html/prog/progch3.html#progs...</a><p>- Delphi: <a href="http://docwiki.embarcadero.com/RADStudio/Rio/en/Inline_Assembly_Code_Index" rel="nofollow">http://docwiki.embarcadero.com/RADStudio/Rio/en/Inline_Assem...</a><p>You can even do assembly in batch files via Debug if you really want to:<p><a href="https://thestarman.pcministry.com/asm/debug/debug2.htm" rel="nofollow">https://thestarman.pcministry.com/asm/debug/debug2.htm</a><p><a href="https://www.robvanderwoude.com/debug.php" rel="nofollow">https://www.robvanderwoude.com/debug.php</a>
Odd bit of news reporting on something that was part of a standard published in 1997. What's next, breaking news on a standard 7-bit code used by Americans for information interchange?
I don't see anything on that page referencing C++20. Am I missing something?<p>On a related note, I always find the official docs for GCC inline assembly are insufficient for figuring out what I am trying to do. I nearly always have to resort to dumb trial and error. I was just recently planning to write some docs of my own on the subject. Not tutorial docs, but reference docs.
Years ago, I started work on a library that does this in Java: <a href="https://github.com/dvx/jssembly" rel="nofollow">https://github.com/dvx/jssembly</a><p>The syntax looks like this:<p><pre><code> jsm.define("test", new Block(x64) {{
__asm(
"nop", // no-op
"ret" // return
);
}}).invoke();</code></pre>
Tangentially related but in gcc and clang you can jump to or call machine language embedded within string literals.<p><a href="https://stackoverflow.com/questions/48593734/calling-goto-on-a-wide-char-string-in-c-gcc/49063073#49063073" rel="nofollow">https://stackoverflow.com/questions/48593734/calling-goto-on...</a><p><a href="https://codegolf.stackexchange.com/questions/2203/tips-for-golfing-in-c/104999#104999" rel="nofollow">https://codegolf.stackexchange.com/questions/2203/tips-for-g...</a><p>This is <i>not</i> recommended for anything in production but is an amusing parlor trick.<p>Edit: Recent toolchains may require the -zexecstack flag to avoid a segfault.
Old, well-known feature of one of the most popular languages. I must be missing something, because I have no idea how this became a hacker "news" :)
I was a Forth dev a long time ago (on a planet far away...). Switching to & from assembly seemed as natural as breathing. Oh for the days of 16bit cores and minuscule register banks.