473,666 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c++ & inline asm

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 (meaning that the compiled
program might probably use some other register in place of eax)

Thanks.

Ps. I do not have any intention to use inline asm.
Jul 23 '05 #1
5 2157
__PPS__ wrote:
I have a simple question about inline asm.
suppose I have asm { push eax, 123 }
Actually, you're supposed to have

asm ( "push eax, 123" ) ;

(IOW, inside the parentheses there should be a string literal),
according to the Standard, subclause 7.4. Any other form, like

asm { <actual assembly commands> }

is probably an extension provided by the compiler.
does it mean that it will have exactly this effect as in usual asm or
it's just a suggestion to the compiler (meaning that the compiled
program might probably use some other register in place of eax)
The meaning of the asm definition is implementation-defined. The
usual purpose is to convey something to the assembler, often insert
a short piece of assembly code into the function. And, yes, usually
the code is assembled *exactly* as written.
Thanks.

Ps. I do not have any intention to use inline asm.


LOL... Why the question, then?

V
Jul 23 '05 #2
> > Thanks.

Ps. I do not have any intention to use inline asm.


LOL... Why the question, then?


Victor, it's because my good friend Artur says that asm is more
`powerful` when it comes to precise control of which register should be
used etc etc. He says that asm( "whatever") blocks only give compiler a
tip but aren't for sure included as-is (similar to inline keyword)

Thanks

Jul 23 '05 #3
pa**********@gm ail.com wrote:
Victor, it's because my good friend Artur says that asm is more
`powerful` when it comes to precise control of which register should be
used etc etc. He says that asm( "whatever") blocks only give compiler a
tip but aren't for sure included as-is (similar to inline keyword)

The standard says:

"7.4 The asm declaration

An asm declaration has the form

asm-definition:
asm ( string-literal ) ;

The meaning of an asm declaration is implementation-defined. [Note: Typically it is used
to pass information through the implementation to an assembler. ]"
So its behaviour is implementation-defined. However in most compilers it is used to pass
instructions directly to the assembler. In other words, in most compilers the passed
instructions are used, and are not considered a suggestion.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #4

"__PPS__" <bl******@mail. ru> wrote in message
news:72******** *************** ***@posting.goo gle.com...
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 (meaning that the compiled
program might probably use some other register in place of eax)


Compilers that implement an inline assembler usually implement it as exactly
the instructions listed. After all, that's the whole point of having one.

-Walter
www.digitalmars.com/ctg/ctgInlineAsm.html C++ inline assembler
www.digitalmars.com/d/iasm.html D inline assembler
Jul 23 '05 #5
Thanks for the info, now I'm sure about this topic :)

Jul 23 '05 #6

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

Similar topics

2
4774
by: David Morgan | last post by:
Hello I have been using the CDONTS.Newmail object for a number of years to send nicely formatted HTML Emails with inline images. I am now trying to switch over to using CDO and I cannot reproduce this functionality. I am using the AddAttachment method instead of the old AttachURL method but the attached images just show as separately attached files rather than in line in the HTML.
2
4266
by: qazmlp | last post by:
// test.h class test { public : inline void check() ; } ; // test.C inline void test::check() // Is 'inline' optional here?
3
8257
by: Victor Irzak | last post by:
Hello, I have an ABC. it supports: ostream & operator << I also have a derived class that supports this operator. How can I call operator << of the base class for derived object??? Is it at all possible?
0
3001
by: Anne van Kesteren | last post by:
Ok, here it goes. Originally I submitted this proposal to www-style. Since I don't get feedback there, I think I missed a few (maybe a lot) of points. Proposal: <http://lists.w3.org/Archives/Public/www-style/2003Nov/0096.html> (for some strange reason I can't post to that list myself) The first point I missed was of course that CSS3UI is not planning to do anything with FIELDSET and LEGEND
79
5243
by: pinkfloydhomer | last post by:
I want to scan a file byte for byte for occurences of the the four byte pattern 0x00000100. I've tried with this: # start import sys numChars = 0 startCode = 0 count = 0
27
3825
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get failed assertions for assertions that at first thought ought to hold, but that's not important.) At the end is a full program containing the above seemingly
13
2790
by: Leonardo Francalanci | last post by:
With mysql I know how much space a row will take, based on the datatype of it columns. I also (approximately) know the size of indexes. Is there a way to know that in postgresql? Is there a way to pack (compress) data, as with myisampack for mysql? Thank you
4
13217
by: thinktwice | last post by:
i have just made a test project :(win32 console) //file : func.h #ifndef _FUNC_H_ #define _FUNC_H_ void func1() { return; };
3
3311
by: KimberlyM | last post by:
This has been driving me crazy. I hope someone can help. The site displays perfectly in FF but all div's do not show in IE. Please help me find the problem! Thanks! Here is my css. .node-unpublished, .comment-unpublished { background-color : #594133; } .preview .node, .preview .comment { background-color : #ffffea; }
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8785
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.