gcc 4.2 warnings

Josh Sled jsled at asynchronous.org
Fri Oct 5 17:57:01 EDT 2007


Christian Stimming <stimming at tuhh.de> writes:
> Your change, however, is a different expression: With your case, if the char 
> pointer points to a non-empty string, use it, but otherwise use the pointer 
> to an empty string.
>
> Which points me to the question: Which gcc warning did you try to fix here?

The warning was "TransLog.c:254: warning: the address of 'drecn' will always
evaluate as 'true'".


> Looking more into context, it turns out drecn is a local char buffer anyway, 
> hence it can't be NULL anyway. Because of this, here (and only here) you 
> should replace the expresssion direcly by drecn, i.e.
>
>  -               drecn ? drecn : "");
>  +               drecn);

I suggested the {{{ drecn[0] == 0 ? [...] }}} form of the fix.

Of course, "drecn[0] == 0" just means the string is already empty.
So, you're totally right; it should just be "drecn".

But, there was a bit of a miscommunication about how to make the change,
anyways.  As you'd quoted, if drecn[0] == 0, then the string drecn is empty,
and it'll be printed.  Otherwise (when drecn actually has a value), it will
use "" instead.

Thanks for the code review.

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20071005/ca07de4f/attachment.bin 


More information about the gnucash-devel mailing list