4 ms·
That's POSIX, not the C language standard. https://www.iso-9899.info/n1570.html#7.31 https://www.iso-9899.info/n1570.html#7.31 lists the library API names reser
by ameliaquining 4y ago
That's POSIX, not the C language standard. https://www.iso-9899.info/n1570.html#7.31 https://www.iso-9899.info/n1570.html#7.31 lists the library API names reserved for future use; section 7.1.3 in the same document states explicitly that they are reserved.
It's not that the word "island" has any particular significance; it's that all names starting with "is" followed by a lowercase letter are reserved (in external linkage and in the global scope of files that #include <ctype.h>), so that future versions of the language can add more standard library functions along the lines of isalpha, isdigit, etc., without making the current standards committee guess in advance which specific names following that pattern their successors might want to add in the future, and without breaking existing code. (Unless that existing code ignores these rules, which seems to be fairly common in practice.)
- SAI_Peregrinus 4y agoThe C is of course a pirate's favorite language. It might end up with "water" and "land" types in the standard some day. So `bool iswater()` and `bool island()` functions might be needed! You might need to check if the island structure you got is really land, so `island(&possible_island)` would obviously help and not cause any confusion to readers of the code.
- sokoloff 4y agoYou might want to know if you have a small piece of land surrounded by water, so we need isisland(x); Or to know if an element is a member of a particular terror group (or an Egyptian goddess): isisis(y);
- cozzyd 4y agoAnd if you want to know if some territory is claimed by a particular terror group (or Egyptian goddess, or post-metal band) there is the venerable isisisland(z); In this case you'd typically then construct a memory fence.
- ketralnis 4y agoAye, any pirate's first love be the C
- cozzyd 4y agoYou just have to pass the pirate flag to your compiler
- 0xADD1E 4y agoI think you’ll find it’s actually called an arrgument
- Gibbon1 4y agoOf course depending on how locale is set will effect the results of island() and iswater()
- xigoi 4y agoThey could just generate a random string, making it extremely unlikely that it will conflict with an existing name. And it won't be any less descriptive than most existing names in the C standard library.
- pcwalton 4y agoI saw someone point out that these identifier restrictions mean that a valid C compiler optimization would be to change all instances of "x = to[a-z]+(y);" to "if (!is[a-z]+(y)) x = to[a-z]+(y);" Not that any compiler would actually be absurd enough to implement this, of course :) Naturally, this would imply the validity of the optimization: x = toilet(y); -> if (!isilet(y)) x = toilet(y);
- caf 4y agoOnly if you've included <ctype.h> or <wctype.h> though.