Re: Hijacked: C vs C++

Tom, wb6b

The Arduino design recommendations are to hide as much of the nitty gritty details from the users as possible. They even recommend not exposing the user to the horror of "char *" and use "char whatever[]" instead. 

I use the string class when it makes it easier for a user to understand what is going on or simply makes my programming effort go faster. The Arduino is not like a Unix machine at a company. it is usually running the same small set of tasks over and over again, so many of the memory allocations that would lead to memory fragmentation will settle out as the routines will find a home for their memory allotments in the memory blocks they the previously abandoned. So if the percentage of holes stabilize and is not a fantastically large percentage it seems a fair tradeoff. 

If I was short on memory and had to shoehorn yet another feature into the fixed resources of one processor, I'd regret using the String class. And I'd probably move to the chip manufacture's leaner tool chain. But, in a $3.50 Nano with only half the resources being used, the convenience of the String class is worth it. String provides a nice encapsulation of the things people do with strings. So, depending on the situation I'll use convenience classes at one moment and do direct point manipulation in another. 

Tom, wb6b

Join to automatically receive all group messages.