C99 Arrays

Today, I learned that a cool “new” C feature had snuck up on me. This was added in C99, and it has apparently been integrated into Objective-C (where I stumbled across it) as well. Briefly, this sort of thing is now legal:

void quux(int x)
{
    char someArray[x];    // Illegal in K&R or ANSI C, ok in C99

    ...other, less interesting code...
}

(Previously, “x” would have had to be a constant that could be determined at compile-time.)

I guess I should pay more attention to this sort of thing.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in iPhone. Bookmark the permalink.

Comments are closed.