Teaching Geek std C – forgot the pain of it!

Teaching Geek std C and I’d really forgotten the pain of working in non-oop std C land.

First hurdle he hit was returning a multidimensional array from a function (the map from the () function). So he figured out from the docs that the had to return a pointer to the array but then had to learn about stack variables going away when a function returns…

I’d forgotten just how painful allocating and deallocating multidimensional arrays in std C is, especially if you actually put in the error checking and code to clean up if you fail part way through allocating all the second level array memory.

He kept telling me how much easier this would be in Python. Which made me think of Apple’s latest restriction on languages allowed on the iPhone OS. Tying yourself to old school languages can be a problem in the long haul… ObjectiveC has evolved some, however it clearly needs to keep evolving as the hardware gets faster (e.g., garbage collection) or the entire platform gets left behind. Obviously this is not an immediate issue, nor even a near term issue, but at some point it may be.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: