Skip to content

Comment on A nice, little known C feature: Static array indices in parameter declarationsparent

Comments

> Another advantage of C over Old C++ is that there's one C, defined by one standards document and maybe a few common features that are not standard but reliably present on most compilers and hardware. There isn't a list of features you're theoretically able to use but the compilers don't support (templates in Old C++) or common things you do differently in every implementation.

If only this was true

http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

I had to develop with multiple C commercial compilers between 1999 and 2002, across several OS. The code had quite a few #ifdefs because of them.

Are you aware that C11 has optional features?

> Pascal figures in this in that the official standard Pascal was basically unworkable as a language, due to features like the size of an array being an obligatory part of its type and the resulting lack of a way to write a function that could handle more than one size of array. Having it be optional, as we see here in C, is really the only way to go unless an array knows its own size and won't let you overstep the bounds.

The first ISO standard yes, but all Pascal dialects always had feature parity with C, while being more type safe, fast compile times and direct support for modules.

Most of it was made part of the ISO Extended Pascal standard, which most people ignored as the industry cared more about Turbo Pascal compatibility. Both solve your arrays example.

The common complaint that the stronger type checking languages impose performance penalty with arrays bound checking is always wrong, as the compilers allow for it to be turned off.

In both cases it is the problem with standards and vendor differentiation, you seldom get a 100% compliant implementation of any standard.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.