This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: filtering of commands during async operation


> Good example of why it's useful to avoid using ! with strcmp.
> 
>  > The code should be:
>  > 
>  > if (event_loop_p && target_can_async_p () && target_executing) {
>  >    if (!(strcmp (c->name, "help") == 0)
>  > 	    && !(strcmp (c->name, "pwd") == 0)
>  > 	    && !(strcmp (c->name, "show") == 0)
>  > 	    && !(strcmp (c->name, "stop") == 0)) {
>  >    error ("Cannot execute this command while the target is running.");
>  >    }
>  > }
>  > 
>  > Unless someone objects I am going to put in a bug report and a patch.
> 
> Why not just strcmp () != 0

Why not just strcmp() ?

  if (strcmp() 
      && strcmp() 
      && strcmp())

-- 
Grant Edwards
grante@visi.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]