[U-Boot-Users] Changing u-boot relocation scheme
Haavard Skinnemoen
haavard.skinnemoen at atmel.com
Thu Jul 24 11:58:24 CEST 2008
vb <vb at vsbe.com> wrote:
> > int (*pf)(struct cmd_tbl_s *, int, int, char *[]) = do_ptrt;
> >
> > int do_ptrt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> > {
> > printf ("pointer is %p\n", pf);
> > printf ("function is %p\n", do_ptrt);
> > return 0;
> > }
Just do this instead:
int (*pf)(struct cmd_tbl_s *, int, int, char *[]);
int do_ptrt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
if (!pf)
pf = do_ptrt;
printf ("pointer is %p\n", pf);
printf ("function is %p\n", do_ptrt);
return 0;
}
IMO, it's best to avoid such pointers in the first place, especially
ones that are statically initialized.
Haavard
More information about the U-Boot
mailing list