lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, May 20, 2020 at 4:53 PM Sean Conner <sean@conman.org> wrote:
>
>   It's pretty bad actually.  The following are reserved by C (using the C99
> standard and the pattern "*" matches the character set for a valid
> identifier):
>
>         The keywords (obviously) (6.4.2)
>         any id matching ^_[A-Za-z_]* (7.1.3)
>         function matching *[fl] (7.26.1)
>         function matching is* or to* (7.26.2)
>         macro matching E[0-9A-Z]* (7.26.3)
>         macro matchint PRI[a-zX]* or SCN[a-zX]* (7.26.4)
>         macro matchint LC_[A-Z]* (7.26.5)
>         macro matching SIG[A-Z]* or SIG_[A-Z]* (7.26.6)
>         typedef matching int* uint* *_t (7.26.8)
>         macro matching INT*_MAX INT*_MIN INT*_C UINT*_MAX UINT*_MIN UINT*_C (7.26.8)
>         function matching str[a-z]* (7.26.10)
>         function matching mem[a-z]* wcs[a-z]* (7.26.11)
>
>   C11 adds the following (using the C11 standard here):
>
>         macro matching ATOMIC[A-Z]* (7.31.8)
>         typedef matching atomic_[a-z]* memory_[a-z]* (7.31.8)
>         enum matching memory_order_[a-z]* (7.31.8)
>         function matching atomic_[a-z]* (7.31.8)
>         macro matching TIME_[A-Z]* (7.31.14)
>         any id matching cnd_[a-z]* mtx_[a-z]* thrd_[a-z]* tss_[a-z]* (7.31.15)
>
>   POSIX might carve out more, but that's left as an exercise to the reader.
>
>   -spc

It's not good, but it's also not quite as bad as you make it sound.
Most of those are only reserved when a certain header is included, and
even then, it's not as broad as you wrote it out to be. In particular,
7.26.1 lists nine specific names, and says that those same nine names
followed by a single 'f' or 'l' are also reserved, not everything that
happens to end with an 'f' or 'l', and 7.26.8 only reserves int*_t and
uint*_t, not all of int*, uint*, and *_t.

Joseph C. Sible