DPRG List  

DPRG: Poke

Subject: DPRG: Poke
From: john.r.strohm at bix.com john.r.strohm at bix.com
Date: Mon Aug 16 23:28:26 CDT 1999

>Why do so many robotics C programmers insist on using peek() and
>poke()? Those look like ugly hangovers from the bad old BASIC days.
>Neither is necessary nor desireable in a C environment.

Because peek() and poke() are mnemonic, and tell everyone looking at the
code that something nefarious involving memory-mapped hardware is going on.

Because peek() and poke() may have more going on than "simple" peeking and
poking.  There may be timing issues involved, or special hardare that must
be set up around each hardware reference.

Because particulars of hardware may change, necessitating a change to
peek() and poke() protocol.

And note that there is nothing whatsoever preventing the programmer from
#defining peek() and poke() as macros that do appropriate things.


More information about the DPRG mailing list