This is the mail archive of the gdb-patches@sourceware.org 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: RFC: MI - Detecting change of string contents with variable objects


On Fri, Jan 05, 2007 at 02:09:30PM +1300, Nick Roberts wrote:
>  > Can you use 
>  > 
>  >         strcmp (var->print_value, print_value) != 0
> 
> Is that more legible?  I sometimes see "if (fi != NULL)" but "if (fi)"
> seems clearer.  Maybe it comes from programming in Lisp for Emacs.

Speaking only for myself, I have no preference between "if (fi !=
NULL)" and "if (fi)", but I always use "!= 0" with strcmp; that's just
because strcmp's return value is so frequently misused. The != 0 makes
it clear that someone knew what result they were checking for.

-- 
Daniel Jacobowitz
CodeSourcery


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