16.10.2018, 15:13
Quote:
If there is a limit of 31 characters, there must be a reason, no?
Also i don't like long function names, they're useless and confusing. But that's my opinion. Someone else will find this useful. Good job. |
The limit might have been useful for C programmers in times where variable-length arrays needed explicit destruction, so they could simply allocate 32 characters on the stack, without worrying about the deallocation, and know that all names fit inside, but since there is amx_NameLength (which you should use according to the GCA), you can dynamically allocate the buffer in C++ (or use alloca) based on the length.
In my opinion, arbitrary bounds based on no real limitations are bad, but there might be another reason for this. Certain mechanisms that work with already existing names might need to "expand" them a little bit (mangling for example), so if there is a function SetPlayerChatBubbleForPlayer (28 characters), turning it into SetPlayerChatBubbleForPlayer@6uuSufi (36 characters) is already over the limit.
You could argue that using abbreviated forms instead of the componenets fixes this (SetPlChBubbleFPl), but I'd rather not have my code turned into WINAPI, thank you.