NOP pointer

T

TefJlives

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

Greg
 
B

Ben Pfaff

TefJlives said:
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.
 
M

Malcolm McLean

TefJlives said:
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.
 
K

Keith Thompson

Ben Pfaff said:
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.)
 
T

TefJlives

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.

Greg
 
K

Keith Thompson

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?
 
R

Richard Bos

TefJlives said:
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
 
S

santosh

TefJlives said:
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.
 
M

Malcolm McLean

santosh said:
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.
 
C

Christopher Benson-Manica

Malcolm McLean said:
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.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top