> > Thanks Erik, Sape, and > Skip. That was such a STUPID error, and I thank > > you all for the extra eyes. I think it is time > for a break and a bowl of > > tea... > > relax. not stupid, subtle. it takes vigilance > to keep > sizeof, nelem, strlen, and the number of characters > straight.
This is part of why I often recommend (and generally do myself) that sizeof only be used on types, not variables: Foo bar; use sizeof(Foo) rather than sizeof(bar). It does require slightly more work for arrays: Foo bar[NFOO]; requires NFOO * sizeof(Foo) rather than sizeof(bar), but I personally think it's worth it to keep the distinction between sizeof and strlen straight. BLS