Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/usb



On Sat, Apr 21, 2018 at 09:30:20AM +0200, Manuel Bouyer wrote:
> > > 
> > >-       axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl);
> > >+       axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, hashtbl);
> > >
> > >missing & ?
> > 
> >         uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 
> 
> So I guess the code was wrong before; not sure how multicast could have
> worked.

No, the address is only needed as rhs of the cast. If passed directly,
the address will be used (due to arrays being passed as pointer to first
element in C).

Try it:

#include <stdio.h>
#include <inttypes.h>

int main(void)
{
        static uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };

        printf("%p vs %p\n", (void *)&hashtbl, hashtbl);
        return 0;
}


Martin


Home | Main Index | Thread Index | Old Index