473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Inline assembler errors

I'm getting errors saying there's too many memory refrences for add and
mov; here's the code:

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
int i=0;
asm("mov eax,i");
asm("add eax,12");
asm("mov i,eax");
cout << "The value of i is: " << i;
system("PAUSE");
return 0;
}

I'm using Dev-Cpp; can you help me on this? Thanks!!!

Sep 19 '05 #1
1 1204
int i=0;

__asm mov eax, i;

__asm add eax, 12;

__asm mov i, eax;

std::cout << "The value of i is: " << i;

this way works fine for me
Sep 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: qazmlp | last post by:
My class in a header file, contains inline virtual destructor. Is this Ok? Can it cause any problems? class base { public: base() { } virtual ~base { std::cout<<"Inside virtual destructor\n";...
3
by: Dave | last post by:
Hello all, I have one method of a class calling another method (both private, though that shouldn't matter). The method and its enclosing class are declared in a .h file and the method is...
3
by: Peng Yu | last post by:
Hi, I'm trying to define inline_test::test() to be inline. But I always got errors. I know that if I define inline_test::test() in inline_test.h, there are no errors. But I still would rather...
5
by: __PPS__ | last post by:
Hello I have a simple question about inline asm. suppose I have asm { push eax, 123 } does it mean that it will have exactly this effect as in usual asm or it's just a suggestion to the compiler...
43
by: Patrick Laurent | last post by:
Hello I have a program with many many inlined template functions It is essential for the execution speed that every (or almost every) function marked as inlined, becomes really inlined by the...
4
by: mashrur.mia | last post by:
Hello All, Since "inline" keyboard is basically an advice to the compiler to inline a function, is there a way to know whether the complier took the advice? I guess one way to verify is to...
10
by: Protoman | last post by:
I'm having the trouble getting the inline assembler and/or linker of Dev-Cpp to see my variable that's been passed into the C++ fn where the inline ASM code is. Can anyone help me figure out how to...
3
by: starffly | last post by:
I overloaded operator+ in a class, and I want to invoke this operator in inline assemble like this: _asm call operator+ but it cannot be complied OK. compiler says there are some illegalI...
5
by: Digital Puer | last post by:
I got this on an interview: Is it possible to write inline recursive functions? I said yes, but there is no guarantee that the compiler will definitely inline your code even if you write...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.