Hi,

the problem is that this is a warning generated by the linker to warn the
user that
he potential swapped the arguments which it does since 0 occurs more often
on
the value side and memset(*,0,0) actually does nothing.

Cheers,
-Bernhard

2015-08-20 16:17 GMT+02:00 Scott Robison <scott at casaderobison.com>:

> I suspect this is similar to another "recent" discussion about passing null
> pointers to mem* library functions. C89 allowed zero or null. C99 seems to
> forbid it. I'm going from memory here, can look at standards later if
> desired
> On Aug 20, 2015 8:08 AM, "Richard Hipp" <drh at sqlite.org> wrote:
>
> > On 8/20/15, Bernhard Schommer <bernhardschommer at gmail.com> wrote:
> > > Hi,
> > >
> > > the warning which is mentioned in the ticket
> > > f51d9501800de5a0fb69d5048ce6662981b461ec still occurs also with newer
> gcc
> > > versions. The ticket was closed after a gcc bug report was opened. The
> > gcc
> > > bug was closed due to a missing testcase.
> > > I had a quick look at the problem and it seems that the warning is
> right
> > > since in certain context and with optimizations enabled gcc can prove
> > > that EXPR_FULLSIZE
> > > - nSize == 0 and thus the triggered warning for this is correct.
> >
> > I cannot find anything in the memset() documentation that says that
> > the third parameter must be greater than zero.  Am I missing
> > something?  Do there exist implementions of memset() for which that is
> > so?
> >
> > On the other hand, if all conforming implementations of memset() must
> > work correctly even if their third argument is zero, why is gcc
> > warning me about this?
> >
> > > Replacing
> > > memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
> > > By
> > > if(EXPR_FULLSIZE-nSize > 0)
> > >      memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
> > > would remove the warning,
> > >
> > > Cheers,
> > > -Bernhard
> > > _______________________________________________
> > > sqlite-users mailing list
> > > sqlite-users at mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> > --
> > D. Richard Hipp
> > drh at sqlite.org
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to