Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

high-level NOP

39 views
Skip to first unread message

bob

unread,
Sep 26, 2012, 5:12:23 PM9/26/12
to
Am I the only one who adds a lot of "NOP" statements to my code just so I can put a breakpoint there?

For instance, in Java I might add:

System.out.println("whatever");

just so I can put a breakpoint there.

Does anyone else do this?

Should there be a high-level NOP that is easy to type?

Daniel Pitts

unread,
Sep 26, 2012, 5:21:01 PM9/26/12
to
Why not put a break-point on the statement directly after that? That
requires no typing what-so-ever.

Robert Wessel

unread,
Sep 26, 2012, 6:26:07 PM9/26/12
to
That may not be convenient - consider that if the following statement
begins a loop, your breakpoint will likely hit for every loop
iteration.

But to the OP, yes, on occasion I have, but it's rare enough that any
difficulty in typing it is irrelevant. But you really want something
with few or no side effects, but that won't get optimized away or use
a lot of resources. In Windows I've used a call to the (system)
GetTickCount() and ignored the results.

BGB

unread,
Sep 26, 2012, 8:45:14 PM9/26/12
to
public static void nop()
{ /* does nothing */ }

...

SomeClass.nop();

?...


maybe as a class:
public class NOP extends Object {
public static void nop()
{ /* does nothing */ }
}

NOP.nop();

?...


bob

unread,
Sep 27, 2012, 1:54:26 PM9/27/12
to
It seems like a lot of times the variables I'm interested in are out of scope on the next line.

bob

unread,
Sep 27, 2012, 1:58:01 PM9/27/12
to
In Windows C++, you could probably do something like

#define N GetTickCount();

Then you just do a NOP like this:

N


Java probably doesn't have anything that succinct.

Daniel Pitts

unread,
Sep 27, 2012, 4:52:46 PM9/27/12
to
Then put the break-point on the point immediately before?
0 new messages