Phillip Pearson - web + electronics notes

tech notes and web hackery from a new zealander who was vaguely useful on the web back in 2002 (see: python community server, the blogging ecosystem, the new zealand coffee review, the internet topic exchange).



Someone doesn't like the C language. How original! I mean, I bet he's the first person to have beaten himself 'round the head for using a language without a builtin string type ...

Everyone who uses C uses it for a reason. My reason for using C is that it results in small object code, and you can get a compiler for any device. I wrote most of an XML parser in C last night. It would have been easier to do it in Python, or I could just have used one of the many libraries that do it, but I did it in C because it has to run on a chip with under 200K of memory. Even expat, the smallest parser I know of, is too big for this.

I had to handle the strings the manual way, I had to allocate my own arrays, and handle freeing everything and not damaging bits of memory when working with them. It's not fun, but that's the price you pay for using a language that compiles down to very small code and has a compiler for the hardware I'm targetting.

If you want type safety and better datatypes -- strings, lists, etc -- you can use C++, which beats Pascal by a long way. If you want memory security and warnings when you cast between ints, unsigneds and bools, use Java. If you want to do some speed hacking or generally just Get Stuff Done, use Python. C# and Perl are also acceptable. Pascal if you really want it. But you're wasting your time complaining about C because everyone already knows. Every language has its pros and cons. C has plenty of cons, but it serves its niche very well. Does your favourite language?

... more like this: []