Re:Asmttpd – Web server for Linux written in amd64 assembly
by lelf on Tuesday May 19, 2015 @02:47PM
(#9572239)
Maybe it's just me, but I honestly don't know what this is doing near the HN top. It's more or less literal translation from C.
[ Parent
| on HN ]
Re:Asmttpd – Web server for Linux written in amd64 assembly
by kbenson on Tuesday May 19, 2015 @02:59PM
(#9572306)
Possibly because it illustrates that using assembly isn't necessarily the insane scary idea that it first seems to many (like me), even to those that should know better because they have used it in the past (like me).
Re:Asmttpd – Web server for Linux written in amd64 assembly
by bjourne on Tuesday May 19, 2015 @05:46PM
(#9573383)
No, a literal translation is what you get when you write a http server in C and inspect what assembly code it produces for x86.64. Since this assembly code is nowhere close to that output it is not a literal translation.
Re:Asmttpd – Web server for Linux written in amd64 assembly
by rdc12 on Wednesday May 20, 2015 @04:18AM
(#9575066)
Only if you use a completley naive compiler, any level of optimisation moves from being a literal translation
Re:Asmttpd – Web server for Linux written in amd64 assembly
by bjourne on Wednesday May 20, 2015 @06:02AM
(#9575341)
No, any correct translation a c compiler produces is, by definition, a literal translation.
Re:Asmttpd – Web server for Linux written in amd64 assembly
by rdc12 on Wednesday May 20, 2015 @07:06PM
(#9579952)
No, that simply means that they are semantically equivilant, which is very different to a literal translation. To quote an online dictionary [0], "2. Word for word; verbatim: a literal translation.". Optimisation in compilers is certainly not word for word.
Take a simple problem like the FizzBuzz problem, write it as the simple obvious branching style. Now compile it with GCC or Clang (with -O3) and you end up with lookup table (or at least I did a few months back. Semantically equivalent but not literal "word for word" translation.
Re:Asmttpd – Web server for Linux written in amd64 assembly
by bjourne on Thursday May 21, 2015 @04:46AM
(#9581601)
You are missing that there exists many more than one literal translation for a particular C program to asm. Using your logic a compiler could not produce a literal translation of any program unless its output to 100% matched that of all other compiles for the same program.