The worst form of inequality is to try to make unequal things equal – at least according to Aristotle. On the other hand, software engineering tries quite hard to deal with unequal things in the same way. Think for example to the file system concept, it is very handy to deal with data in your hard disk in the same way you deal with data stored on a server across a network connection. As Joel suggests pushing abstractions too hard may hurt, but I think it is hard to disagree that it is very convenient to produce video output regardless of the screen resolution or manufacturer.
So, wouldn’t it be nice to deal with strings regardless they are null-terminated C strings or C++ iterable string? Yes of course, but what does the compiler think about this? Would it generates comparable, if not equal, machine code?
Continue reading “C Strings, a C++ View”