potentially incorrect conversion of pointer to unsigned long

Vincent Lefevre vincent at vinc17.org
Sat Jun 22 19:14:01 UTC 2019


On 2019-06-22 12:40:39 +0200, Oswald Buddenhagen wrote:
> On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
> >         p->init = (unsigned long) safe_strdup (* ((char **) p->data));
> >
> > IMHO, the best solution for safety would be to use a union (I think
> > that this would require the use of C99 designators for the MuttVars
> > initialization). Otherwise check (uintptr_t) -1 <= (unsigned long) -1
> > in configure.
> > 
> it's easier to just use !! or put != NULL at the end instead of the cast.

AFAIK, the value itself matters, not just the fact that it is
non-zero.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Mutt-dev mailing list