Yesterday I had to do something I have so far avoided my entire
programming career: use the features of C++. [I kept my head when all
around me were losing theirs on Smalltalk; I took the same approach with
C++ but I was finally run to ground].
I needed the C++ equivalent of a list of boxed strings. Can't be so
hard, right, with all those classes, templates, objects, whatnot? I
found some code that had a list of strings, and used it. Failure.
It turns out that "string" means different things to different people:
some think it's just an array of characters (char[]), while others think
it's a null-terminated memory area pointed to by a (char *). The class
I was using expected null-termination, and my strings contained nulls,
so assigning a = b; set b equal to a, but only up to a point.
It took me about an hour to figure out that the problem was the meaning
of "string", which is unambiguously defined in many places, but with
conflicting definitions. Then another half-hour to work out that what I
wanted was (list<string>) because (list<char[]>) isn't supported. Then
10 minutes to solve the problem.
I ended up with the thought that documentation is hard to read whenever
the topic is unfamiliar. I'm just saying.
Henry Rich
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm