On Sat, Apr 17, 2010 at 03:19:49PM -0400, William Chops Westfield wrote: > > On Apr 17, 2010, at 11:53 AM, Byron Jeff wrote: > > > it brings consistency to structure access. > > That's rather neat. Does it solve the "." vs "->" annoyance inside > nested structures as well? > > struct a { > struct b ab[1]; > struct c* ac; > struct d ad; > } *aa; > > Normally you'd need to remember to say "aa->ac.acinsides" vs "aa- > >ad.adinsides", > but can you now say aa->ab->abinsides even though ab storage is part > of aa ? Yep. It's totally self consistent. And exactly the headache it's designed to get rid of. > > > > But it's not very efficient on eight-bit PICs as far as code > > generation. > > PICs aren't so great at handling pointers in general, but do you think > Byron's technique is any worse than the more traditional alternative > of a pointer and a structure explicitly defined for the same space? > Seems to me that for global structures most of the inefficient pieces > should be eliminated by the compiler (for either style)... Actually one would hope that the compiler is smart enough to know that if you are dereferencing a constant address, which an array name is defined to be. there's no need to actually load that address into an FSR and do an indirect access. But if I really wanted an efficient use for an 8 bit PIC, I can write in assembly. Any compiled language is going to add overhead unless it is optimized. BAJ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist