[Plugin] Long Function Names
#3

Quote:
Originally Posted by KinderClans
View Post
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 is completely arbitrary; in older versions of AMX, the size of a record was fixed, but now all names are located in the name table which is just a pool of variable-length strings. The only functions in the API that depend on on the limit are amx_Init, amx_Cleanup, amx_FindNative, amx_FindPublic, and amx_FindPubVar. All of these functions except for amx_Cleanup are hooked by this plugin, removing the dependency.

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.
Reply


Messages In This Thread
Long Function Names - by IllidanS4 - 16.10.2018, 13:01
Re: Long Function Names - by KinderClans - 16.10.2018, 14:26
Re: Long Function Names - by IllidanS4 - 16.10.2018, 15:13
Re: Long Function Names - by GangstaSunny. - 16.10.2018, 16:13
Re: Long Function Names - by SyS - 16.10.2018, 16:41
Re: Long Function Names - by Peek - 16.10.2018, 21:36
Re: Long Function Names - by Gammix - 16.10.2018, 22:44
Re: Long Function Names - by Whyd - 16.10.2018, 22:50
Re: Long Function Names - by Spoookymon - 27.10.2018, 14:12
Re: Long Function Names - by RogueDrifter - 27.10.2018, 14:43
Re: Long Function Names - by IllidanS4 - 27.10.2018, 15:33

Forum Jump:


Users browsing this thread: 1 Guest(s)