Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7182723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:49:51+00:00 2026-05-28T17:49:51+00:00

Specifically, I want to write a macro that 1) allows me to set a

  • 0

Specifically, I want to write a macro that

1) allows me to set a breakpoint
2) does nothing else
3) causes no compiler warnings

#define NO_OP   ((void)0)

void main()
{
    bool b = true;
    if (b)
        NO_OP;  // I try to set a breakpoint here, but

}               // it jumps to here (in Visual Studio 2010)

I also tried

#define NO_OP   (assert(1))             // doesn't work
#define NO_OP   (sizeof(int))           // doesn't work
#define NO_OP   __asm{}                 // doesn't work
#define NO_OP   do {(void)0;} while(0)  // warning: conditional is constant

The only thing that works so far is the cringe-worthy

#define NO_OP   { int x = 0; x = x; }

There has to be a better way.

EDIT
Thanks Blorgbeard, __asm{ nop } does indeed work. But I just realized that anything with braces is less than perfect (problematic?) because it leaves a useless semi-colon hanging there after it. (Later) I don’t know squat about assembler but I tried removing the braces, and voila! There’s the answer: __asm nop
Thanks!

FOR THE CURIOUS
Here’s a slightly less absurd example:

string token = GetNextToken();
if (!Ignore(token))
{
    // process token
    DoThis(token);
    DoThat(token);
}

This code is complete — as long as the program works correctly I don’t care to know anything about ignored tokens. But at any given time (and without changing the code) I want to make sure that I’m not rejecting good tokens

string token = GetNextToken();
if (Ignore(token))
{
    NO_OP; // when desired, set breakpoint here to monitor ignored tokens
}
else
{
    // process token
    DoThis(token);
    DoThat(token);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:49:52+00:00Added an answer on May 28, 2026 at 5:49 pm

    An actual no-op instruction:

    __asm nop
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a plugin that will extend InheritedResources . Specifically I want
I want to write a macro in C that accepts any number of parameters,
I want to write a GUI seating application that allows users to draw and
I want to write a generic function that has a constraint on the type.
I want to write plug-ins for Adobe products in .NET (C#) (specifically Acrobat Reader
I want to write unit tests with NUnit that hit the database. I'd like
I want to write a program in Objective-c that grabs some sports stats off
Specifically, I want to write this: public Func<IList<T>, T> SelectElement = list => list.First();
I am using SQL Server 2008. I want to write a query that gives
Specifically, I want to write a powershell script to find every file with extensions.lib

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.