Why "Compilation Error?" I used __asm! | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why "Compilation Error?" I used __asm!

I was planning to add 2 numbers and print the sums using __asm, but when I tried to do so, I got an error saying "Compilation error." I checked the code link, and saw that there are no white spaces (invalid ones, characters that has the dot in the middle and is highlighted in red). Could it be possible that the compiler doesn't support __asm? Or are there any errors in my code? https://code.sololearn.com/cFwVpPYbqT8I/?ref=app

5th Feb 2019, 5:37 AM
EoflaOE
EoflaOE - avatar
5 ответов
+ 4
https://en.m.wikipedia.org/wiki/Calling_convention
5th Feb 2019, 6:17 AM
Anna
Anna - avatar
+ 2
Bennett Post Should EAX be used for anything but return values of functions though? 🤔
5th Feb 2019, 7:15 AM
Anna
Anna - avatar
0
Thanks for your answers. Now when I changed the code to reflect changes, I got an error: Assembler messages: Error: junk '-84(%rbp)' after register
5th Feb 2019, 3:26 PM
EoflaOE
EoflaOE - avatar
0
Thanks for your answer Bennett! I accidentally put string instead of int and forgot to put a comma between the operands in line 12 without being aware. Now, I can make more programs that uses asm().
5th Feb 2019, 5:46 PM
EoflaOE
EoflaOE - avatar
0
Thanks! I am going to make all of my further C++ and C codes use the inline assembly to do something. This is to show that SoloLearn supports ASM. I hope they will add ASM lesson.
6th Feb 2019, 5:13 AM
EoflaOE
EoflaOE - avatar