linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* __asm__
@ 2005-03-29  6:48 Ankit Jain
  2005-03-29  7:40 ` __asm__ Steve Graegert
  2005-04-02 13:18 ` __asm__ Glynn Clements
  0 siblings, 2 replies; 3+ messages in thread
From: Ankit Jain @ 2005-03-29  6:48 UTC (permalink / raw)
  To: linux prg

can anybody tell me when we write like this while
writing asm construct then what does underscore mean?

__asm__("construct")

does it have any connection wit volatile?
thanks

ankit



		
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __asm__
  2005-03-29  6:48 __asm__ Ankit Jain
@ 2005-03-29  7:40 ` Steve Graegert
  2005-04-02 13:18 ` __asm__ Glynn Clements
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Graegert @ 2005-03-29  7:40 UTC (permalink / raw)
  To: Ankit Jain; +Cc: linux prg

On Mon, 28 Mar 2005 22:48:28 -0800 (PST), Ankit Jain
<ankitjain1580@yahoo.com> wrote:
> can anybody tell me when we write like this while
> writing asm construct then what does underscore mean?
> 
> __asm__("construct")

Underscores in those contexts usually represent a lanugage extension
and are used to make clear that this contruct may not be part of the
language standard, although a lot of other C compiler may implement
it. GNU C knows about a lot of other extensions like
__attribute__((always_inline)) that is used for function inlining.

> does it have any connection wit volatile?

Yes, it has. It prevents the compiler from modifying the inline asm
code, like reordering of statements and the like. This makes sure,
your code is handled by the compiler as is, so you will be using
__volatile__ most of the time.
 
Kind Regards

    \Steve

--

Steve Graegert <graegerts@gmail.com> // Anyone who considers arithmetical
Software Consultant {C/C++ && .NET} // methods of producing random digits
Mobile: +49 (176)  21 24 88 69     //   is, of course, in a state of sin.
 Voice: +49 (9131) 71 26 40 9     //           -- JOHN VON NEUMANN (1951)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __asm__
  2005-03-29  6:48 __asm__ Ankit Jain
  2005-03-29  7:40 ` __asm__ Steve Graegert
@ 2005-04-02 13:18 ` Glynn Clements
  1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2005-04-02 13:18 UTC (permalink / raw)
  To: Ankit Jain; +Cc: linux prg


Ankit Jain wrote:

> can anybody tell me when we write like this while
> writing asm construct then what does underscore mean?
> 
> __asm__("construct")

Underscores are treated just like letters in macro and symbol names.

By convention, the implementation (compiler, core libraries) puts
underscores at the beginning of any "private" names, so that they
don't conflict with any names which you might use in your code (you
wouldn't normally choose names beginning with underscores in your own
code).

According to the ANSI C99 specification:

       7.1.3  Reserved identifiers

       [#1] Each header declares or defines all identifiers  listed
       in  its  associated  subclause,  and  optionally declares or
       defines identifiers listed in its associated future  library
       directions   subclause  and  identifiers  which  are  always
       reserved either for  any  use  or  for  use  as  file  scope
       identifiers.

         -- All  identifiers  that  begin  with  an  underscore and
            either an uppercase letter or  another  underscore  are
            always reserved for any use.

         -- All  identifiers  that  begin  with  an  underscore are
            always reserved for use as identifiers with file  scope
            in both the ordinary and tag name spaces.

-- 
Glynn Clements <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-02 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29  6:48 __asm__ Ankit Jain
2005-03-29  7:40 ` __asm__ Steve Graegert
2005-04-02 13:18 ` __asm__ Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).