vb <[EMAIL PROTECTED]> 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

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to