string. I've been coding in C++ maybe six years now, and almost all of the time I've been using the old
chararrays instead of
string. Partially its my inherent distrust of automatic memory management (and its effect on things like heap fragmentation), partially its my need to supervise and optimize every action the computer is taking, and maybe there's some value in limiting how much memory inputs can use and preventing denial of service attacks; but really I was just resisting change.
So I've been using strings now, and it hasn't bitten me yet, but I hit a real point of uncomfortableness this evening. I had built up some great routines for dealing with parameter lists (like
param1=aaa¶m2=uuu¶m3), but I had a form that only had one parameter. Did I really want to copy around memory and create all these complex structures just to get the value out when I could just find the
strchr()and then set the
char * to point to the next character? I finally decided, yes for a couple reasonts: