upvote
> we all know this, it makes sense, there's no reasonable alternative

There absolutely are reasonable alternate ways to represent ordered data that don't involve templates. The way that C does it makes sense in most cases, and if you are looking at something that you cannot understand, you are looking at bad code.

> "Declaration follows use" immediately goes out the window when faced with typedeffed types being used as the base type

Typedefs are an abstraction. If you create a typedef, it is usually because you only want to handle the data as a whole, passing it to helper functions that remove the typedef. Also, declaration of use does not break down with typedefs:

    typedef char *(*fn)(int, char *);
    fn my_fn;

    char *s = (*my_fn)(0, ""); // Proper use
> "Declaration follows use" is the type level equivalent of taking off your socks before taking off your shoes because that's the order in which you put them on.

Please give me an example of some C code where this is the case.

reply
> How do you make an std::array of a given type?

std::array isn't a thing in C, so you don't.

reply
Read the whole post genious, I certainly acknowledge that.
reply
Just for future reference, I believe the correct spelling is genius.
reply
I can get behind deliberately misspelling as "genious" when using it sarcastically.
reply
Or disingenious. :)
reply
Oops, my mistake!
reply
>How do you make an std::array of a given type? Wrap the existing type in an extra layer of std::array, we all know this

huh? where is the extra layer?

    std::array<int, 5> array_of_ints = { 1, 2, 3, 4, 5 };
>How do you make a C-array of a given type? Oh boy, "prepend the array specifier before the list of existing array specifiers"

?

    int c_style_array[5] = {2, 3, 5, 7, 11};
reply
I assume he means multi-dimensional arrays:

    std::array<std::array<int, 3>, 5> array_of_ints;
    int c_style_array[5][3];
But the C-style array is more readable, so I am not sure what the complaint really is about.
reply
No, I think he means that for any given type, you can wrap it in an array the same way. Your example is demobstating that it even works recursively, but it works in the simple case too by wrapping "int" in an array to get an array of ints. There's no need to jump back and forth between each side when adding new layers (which gets described as a "spiral", but in a single line of code, I'd argue that it's really just jumping back and forth, and that's why it's annoying to people like the parent commenter and I)
reply
If I would add another array, it would look like:

int c_style_array[2][5][3];

There is also no jumping back and forth. C declarations are also recursively constructed. One can complain about the irregularity of pointers syntax.

reply
The "existing type" in your example is int, the "extra layer" is the array type that "wraps" it
reply
I guess? That's pretty confusing wording, and a bizarre rant if so.
reply