gcc 4.2 warnings

Andrew Sackville-West ajswest at mindspring.com
Fri Oct 5 19:21:51 EDT 2007


On Fri, Oct 05, 2007 at 05:57:01PM -0400, Josh Sled wrote:
> 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.

whoops. that's not good! 

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20071005/851a227b/attachment.bin 


More information about the gnucash-devel mailing list