473,387 Members | 1,899 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,387 software developers and data experts.

asm

Hey everyone...quick question for you.

I was under the impression that the `asm' command was not part of standard
C++ because all assembly language instructions are machine dependent.
However, I noticed that in the grammar appendix of Stroustrup, the `asm'
command is actually listed. I don't actually have a copy of the standard,
so I was just wondering:

Is the `asm' command actually part of standard C++??

************************************************** ***
Josh Lessard
Master's Student
School of Computer Science
Faculty of Mathematics
University of Waterloo
(519)888-4567 x3400
http://www.cs.uwaterloo.ca
************************************************** ***

Jul 22 '05 #1
15 2523
Josh Lessard wrote:
Hey everyone...quick question for you.

I was under the impression that the `asm' command was not part of standard
C++ because all assembly language instructions are machine dependent.
However, I noticed that in the grammar appendix of Stroustrup, the `asm'
command is actually listed. I don't actually have a copy of the standard,
so I was just wondering:

Is the `asm' command actually part of standard C++??


My guess is that it's part of the standard in that it is *reserved* for
use that is implementation specific. This requires conforming code to
not use the "asm" as a possible identifier - thus causing problems for
implementations that do support asm.

Jul 22 '05 #2
Josh Lessard wrote:
Hey everyone...quick question for you.

I was under the impression that the `asm' command was not part of standard
C++ because all assembly language instructions are machine dependent.
However, I noticed that in the grammar appendix of Stroustrup, the `asm'
command is actually listed. I don't actually have a copy of the standard,
so I was just wondering:

Is the `asm' command actually part of standard C++??
The 'asm' keyword is. 'Command' is not a term that has any meaning in
C++, as far as I know. Here's what the November 1997 draft of the
standard says about 'asm':

7.4 The asm declaration [dcl.asm]

1 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. ]

************************************************** ***
Josh Lessard
Master's Student
School of Computer Science
Faculty of Mathematics
University of Waterloo
(519)888-4567 x3400
http://www.cs.uwaterloo.ca
************************************************** ***


Do you think you could trim your sig to a reasonable length (4 lines or
so), and try to convince your news client to use a proper sig delimiter
(dash-dash-space)?

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #3

"Josh Lessard" <jr******@plg2.math.uwaterloo.ca> wrote in message
news:Pi*************************************@plg2. math.uwaterloo.ca...
Hey everyone...quick question for you.

I was under the impression that the `asm' command was not part of standard
C++ because all assembly language instructions are machine dependent.
However, I noticed that in the grammar appendix of Stroustrup, the `asm'
command is actually listed. I don't actually have a copy of the standard,
so I was just wondering:

Is the `asm' command actually part of standard C++??


First note that C++ has no 'commands'.

Then let's look at the standard:

-----------------------------------------

ISO/IEC 14882:1998(E)

7.4 The asm declaration

1 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 informa*tion through the
implementation to an assembler. ]

-----------------------------------------

So the 'asm' keyword is indeed standard, but it's implementation
is necessarily platform/implementation-specific. This is similar
to the 'std::system()' function, which is standard, but whose
argument is platform/implementation-specific.

-Mike
Jul 22 '05 #4

"Mike Wahler" <mk******@mkwahler.net> wrote in message:

"Josh Lessard" <jr******@plg2.math.uwaterloo.ca> wrote in message:

Is the `asm' command actually part of standard C++??


First note that C++ has no 'commands'.


Yeah, but it has plenty of directives, suggestions and hints. ;-)

Then let's look at the standard:

-----------------------------------------

ISO/IEC 14882:1998(E)

7.4 The asm declaration

1 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 informa*tion through the
implementation to an assembler. ]


For completeness, this language hasn't changed in the second edition.

Jonathan
Jul 22 '05 #5
Josh Lessard wrote:
Hey everyone...quick question for you.

I was under the impression that the `asm' command was not part of standard
C++ because all assembly language instructions are machine dependent.
However, I noticed that in the grammar appendix of Stroustrup, the `asm'
command is actually listed. I don't actually have a copy of the standard,
so I was just wondering:

Is the `asm' command actually part of standard C++?


Yes. But that doesn't mean that
the assembler instructions themselves are portable.

Jul 22 '05 #6
Mike Wahler wrote:
First note that C++ has no 'commands'.


Does C++ have "imperatives"?

Jul 22 '05 #7

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Mike Wahler wrote:
First note that C++ has no 'commands'.


Does C++ have "imperatives"?


No such term is defined by the language.

-Mike
Jul 22 '05 #8
Mike Wahler wrote:
E. Robert Tisdale wrote:
Mike Wahler wrote:
First note that C++ has no 'commands'.


Does C++ have "imperatives"?


No such term is defined by the language.


Dissembling?

Is C++ an imperative programming language or not?
http://www.wlug.org.nz/ProgrammingLanguage

http://en.wikipedia.org/wiki/Imperative_programming

http://www.doc.ic.ac.uk/~wjk/C++Intro/

Jul 22 '05 #9
> First note that C++ has no 'commands'.

Yes I got called on that quite a few times. I'm actually well aware of
that fact...it was a poor choice of wording on my part.
Then let's look at the standard:
I really need to get myself a copy of the standard soon. ;)
So the 'asm' keyword is indeed standard, but it's implementation
is necessarily platform/implementation-specific. This is similar
to the 'std::system()' function, which is standard, but whose
argument is platform/implementation-specific.


Gotcha. Thanks a lot for your clarifications.

************************************************** ***
Josh Lessard
M.Math Candidate
School of Computer Science
University of Waterloo (519)888-4567 x3400
http://www.cs.uwaterloo.ca
************************************************** ***

Jul 22 '05 #10

"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:40**************@jpl.nasa.gov...
Mike Wahler wrote:
E. Robert Tisdale wrote:
Mike Wahler wrote:

First note that C++ has no 'commands'.

Does C++ have "imperatives"?
No such term is defined by the language.


Dissembling?


Not at all. Only stating a fact.

Is C++ an imperative programming language or not?


You can call it that if you like. I simply call it
a useful, versatile, and powerful programming language.
In any case, it defines so such construct or concept
'imperative'.

-Mike
Jul 22 '05 #11
Mike Wahler wrote:
E. Robert Tisdale wrote:
Mike Wahler wrote:
E. Robert Tisdale wrote:

Mike Wahler wrote:

>First note that C++ has no 'commands'.

Does C++ have "imperatives"?

No such term is defined by the language.

Is C++ an imperative programming language or not?


You can call it that if you like. I simply call it
a useful, versatile, and powerful programming language.
In any case,
it defines so such construct or concept 'imperative'.


Does it need to?

1. The C++ computer programming language
is an *imperative* programming language.

2. The imperatives are the executable statements
in a C++ program.

3. The word 'command' is a synonym for 'imperative'.

The only reason that I can think of for preferring
the term 'executable statement' or even 'imperative'
over the term 'command' is so as not to confuse
executable statements with [UNIX] shell commands.

I suppose that I would prefer that you say,
"The term 'executable statement' is preferred over the term 'command'
so that they aren't confused with shell commands."

Jul 22 '05 #12
On Sat, 24 Jan 2004 14:47:35 -0800 in comp.lang.c++, "E. Robert Tisdale"
<E.**************@jpl.nasa.gov> was alleged to have written:
The only reason that I can think of for preferring
the term 'executable statement' or even 'imperative'
over the term 'command' is so as not to confuse
executable statements with [UNIX] shell commands.


Good enough reason. Or BASIC language commands, etc..

I think the reason to avoid referring to "commands" in C and C++ is to
remind the reader that the granularity is different than what he may be
used to. We have had people appear here asking about how to use the
"cout command". They won't make much progress until they get the
concept that std::cout is not a command.

Sure, there is no substantial difference between "executable statement"
and "command"; they designate the same set of things. But "executable
statement" rightly suggests that there are also non-executable ones,
namely declarations. This is an important point distinguishing C++
from UNIX shell or other languages where every line is a command.
Jul 22 '05 #13
David Harmon wrote:
E. Robert Tisdale wrote:
The only reason that I can think of for preferring
the term 'executable statement' or even 'imperative'
over the term 'command' is so as not to confuse
executable statements with [UNIX] shell commands.

Good enough reason. Or BASIC language commands, etc..

I think the reason to avoid referring to "commands" in C and C++ is to
remind the reader that the granularity is different than what he may be
used to. We have had people appear here asking about how to use the
"cout command". They won't make much progress until they get the
concept that std::cout is not a command.

Sure, there is no substantial difference between "executable statement"
and "command"; they designate the same set of things. But "executable
statement" rightly suggests that there are also non-executable ones,
namely declarations. This is an important point distinguishing C++
from UNIX shell or other languages where every line is a command.


I agree.

int f(void) {
return 23;
}

int main(int argc, char* argv[]) {
int i = f();
return 0;
}

Do you consider the definition of int i to be an executable statement?
My inclination is to say that it is not.

Jul 22 '05 #14
just is a test~
--
hBifTs <hB****@hotmail.com>

Jul 22 '05 #15
test too~
--
hBifTs <hB****@hotmail.com>

Jul 22 '05 #16

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

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.