4 ms·
The modifiers (pointer, "function taking _ returning _", "array N of", etc.) are prefixed, but they could just as well be postfixed. I think people don't do it
by trealira 3y ago
The modifiers (pointer, "function taking _ returning _", "array N of", etc.) are prefixed, but they could just as well be postfixed. I think people don't do it because it's more similar to English to make the modifiers prefixed.
C:
int *p;
Prefix:
p: pointer to int;
Postfix:
p: int pointer;
Another example.
C:
int (*fp_arr[5])(int, int);
Prefix:
fp_arr: array 5 of pointer to function(int, int) to int;
Postfix:
fp_arr: int (int, int) pointer array 5;
This is something I was thinking about because some non-English languages use post positions instead of prepositions, and say the verb last instead of in the middle. For example, in English, you could say "He looks at me," and in some other languages, you'd say the equivalent of "He me-at looks". Instead of "I went to the bathroom" it would be the equivalent of "I bathroom-to went." And instead of "the fifth day of the month" it might be something like "month of fifth day", except "of" has the opposite meaning. I'm speaking vaguely because I've only read about such languages from a linguistics perspective, and I don't know them. Specifically, head-initial vs head-final languages: https://en.wikipedia.org/wiki/Branching_(linguistics) https://en.wikipedia.org/wiki/Branching_(linguistics)