NOP pointer

Discussion in 'C Programming' started by TefJlives, Mar 12, 2007.

  1. TefJlives

    TefJlives Guest

    Can someone please expain what is a NOP pointer, or give a good link?
    Thanks.

    Greg
     
    TefJlives, Mar 12, 2007
    #1
    1. Advertising

  2. TefJlives

    Ben Pfaff Guest

    "TefJlives" <> writes:

    > Can someone please expain what is a NOP pointer, or give a good link?


    Do you mean a "null pointer"? A null pointer is a pointer that
    has been assigned a null pointer constant. The C99 standard
    defines it like this:

    3 An integer constant expression with the value 0, or such an
    expression cast to type void *, is called a null pointer
    constant.55) If a null pointer constant is converted to a
    pointer type, the resulting pointer, called a null pointer,
    is guaranteed to compare unequal to a pointer to any object
    or function.

    --
    "It wouldn't be a new C standard if it didn't give a
    new meaning to the word `static'."
    --Peter Seebach on C99
     
    Ben Pfaff, Mar 12, 2007
    #2
    1. Advertising

  3. "TefJlives" <> writes:
    > Can someone please expain what is a NOP pointer, or give a good link?
    > Thanks.


    As far as I know, there's no such thing.

    If you're asking about null pointers, see section 5 of the comp.lang.c
    FAQ, <http://www.c-faq.com/>.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 12, 2007
    #3
  4. "TefJlives" <> wrote in message
    news:...
    > Can someone please expain what is a NOP pointer, or give a good link?
    > Thanks.
    >

    Not a clue.
    Normally NOP refer to "no operation". So a function pointer that pointed to
    an empty function might be what you are after.
    For instance, say you are calling code written back in the 386 days which
    used to take a minute to execute. So the caller provided a callback so you
    could spin a line or update a progress bar. Now with your dual core Pentium
    IV it takes less than a tenth of a second to execute, so the callback is no
    longer useful. However you still need to provide something to call, so a
    pointer to an empty function would be appropriate.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm McLean, Mar 12, 2007
    #4
  5. Ben Pfaff <> writes:
    > "TefJlives" <> writes:
    >> Can someone please expain what is a NOP pointer, or give a good link?

    >
    > Do you mean a "null pointer"? A null pointer is a pointer that
    > has been assigned a null pointer constant. The C99 standard
    > defines it like this:

    [snip]

    Assigning a null pointer constant is only one way to produce a null
    pointer. (The standard's definition is unclear on this point.)

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 12, 2007
    #5
  6. TefJlives

    CBFalconer Guest

    TefJlives wrote:
    >
    > Can someone please expain what is a NOP pointer, or give a good link?


    No such beast in the C language.

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>


    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Mar 12, 2007
    #6
  7. TefJlives

    TefJlives Guest

    On Mar 12, 4:53 pm, CBFalconer <> wrote:
    > TefJlives wrote:
    >
    > > Can someone please expain what is a NOP pointer, or give a good link?

    >
    > No such beast in the C language.
    >
    > --
    > Chuck F (cbfalconer at maineline dot net)
    > Available for consulting/temporary embedded and systems.
    > <http://cbfalconer.home.att.net>
    >
    > --
    > Posted via a free Usenet account fromhttp://www.teranews.com


    Thanks for all your replies. I was under a misunderstanding. I was
    looking for a no-op command, but I thought it was some kind of
    pointer. Which is why I couldn't find anything about it on the web.

    Greg
     
    TefJlives, Mar 13, 2007
    #7
  8. "TefJlives" <> writes:
    > On Mar 12, 4:53 pm, CBFalconer <> wrote:
    >> TefJlives wrote:
    >>
    >> > Can someone please expain what is a NOP pointer, or give a good link?

    >>
    >> No such beast in the C language.


    Please don't quote signatures.

    > Thanks for all your replies. I was under a misunderstanding. I was
    > looking for a no-op command, but I thought it was some kind of
    > pointer. Which is why I couldn't find anything about it on the web.


    It sounds like you're looking for a null statement, which looks like
    this:

    ;

    Or you can use an empty compound statement:

    { }

    What are you trying to do?

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Mar 13, 2007
    #8
  9. TefJlives

    Richard Bos Guest

    "TefJlives" <> wrote:

    > Can someone please expain what is a NOP pointer, or give a good link?


    A NOP pointer is a roadsign to the polder where I live.

    HTH; HAND.

    Richard
     
    Richard Bos, Mar 13, 2007
    #9
  10. TefJlives

    santosh Guest

    TefJlives wrote:
    > On Mar 12, 4:53 pm, CBFalconer <> wrote:
    > > TefJlives wrote:
    > >
    > > > Can someone please expain what is a NOP pointer, or give a good link?

    > >
    > > No such beast in the C language.

    >
    > Thanks for all your replies. I was under a misunderstanding. I was
    > looking for a no-op command, but I thought it was some kind of
    > pointer. Which is why I couldn't find anything about it on the web.


    The closest C comes to a NOP command is a null statement: a semicolon
    all by itself. A self assignment may also qualify:

    x = x;

    The compiler will likely optimise both of them away, which is why they
    can't really be considered as equivalent of an assembly language NOP.
     
    santosh, Mar 13, 2007
    #10
  11. "santosh" <> wrote in message
    > The closest C comes to a NOP command is a null statement: a semicolon
    > all by itself.
    >

    It is also used quite a bit.

    for loops with empty bodies that do their work in the condition or increment
    part of the loop are not too uncommonly found. Personally I dislike them,
    but som eprogrammers like to fit a lot of logic onto one line.
    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm McLean, Mar 13, 2007
    #11
  12. Malcolm McLean <> wrote:

    > for loops with empty bodies that do their work in the condition or increment
    > part of the loop are not too uncommonly found. Personally I dislike them,
    > but som eprogrammers like to fit a lot of logic onto one line.


    As imported spaces from China continue driving down their cost, more
    and more programmers are forsaking the megafrugaldaysofthepast (along
    with function names where every character is "prcius") in order to
    explore the new vistas of understanding which unfold in the presence
    of these new cheap spaces.

    (For loops consisting of a single line, including the semicolon, are
    ticking time bombs.)

    --
    C. Benson Manica | I *should* know what I'm talking about - if I
    cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, Mar 13, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saurabh Aggrawal

    _asm NOP : undeclared identifier

    Saurabh Aggrawal, Dec 10, 2004, in forum: C++
    Replies:
    3
    Views:
    3,590
    Thomas Matthews
    Dec 10, 2004
  2. Stef Mientki
    Replies:
    5
    Views:
    343
    Jussi Salmela
    Jan 6, 2007
  3. Replies:
    10
    Views:
    704
    Chris Torek
    Feb 4, 2005
  4. jimjim
    Replies:
    16
    Views:
    844
    Jordan Abel
    Mar 28, 2006
  5. Noob

    Is memcpy with len=0 a NOP?

    Noob, Jan 24, 2011, in forum: C Programming
    Replies:
    16
    Views:
    2,533
    Francois Grieu
    Feb 3, 2011
Loading...

Share This Page