Skip to content

[Feature request] Improve variadic argument support and increase effective variadic argument limit #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Enovale opened this issue May 3, 2025 · 1 comment

Comments

@Enovale
Copy link

Enovale commented May 3, 2025

Currently, SP_MAX_EXEC_PARAMS is set to 32, making it so that function calls cannot contain more than 32 parameters. This, importantly, makes it so that very large formatting class calls cannot be made without formatting multiple times in a row, which can be unacceptable in some cases (Such as using Sourcemod translations). Here's an example from a project of mine Showing how many formatting parameters I need and how I am being limited by the maximum parameters.

Additionally, there is currently absolutely no way to manipulate variadic parameters in any way other than using them in VFormat. You cannot grab individual entries in the parameter stack, nor can you pass along the entire stack to another method.

It is difficult to write clean-looking overloads for a method without being able to pass along variadic parameters. Additionally, a somewhat clean workaround for the first issue I described would be possible if I could iterate over the variadic parameters in chunks of <32 until the format is finished.

I can't say I know what the best solution for this codebase would be, but I would really like to see some improvements to variadic parameters. The most important being effectively increasing how many variadic parameters can be used. It would be even better if the parameters could be enumerated on an individual basis and reused in future method calls, even if it's a bit cumbersome.

The goal is to be able to format a very large formatting string (>32 parameters) using Sourcemod's translation system, and make code quality better with better access to the parameter stack.

@F1F88
Copy link

F1F88 commented May 15, 2025

I think it's a good idea to support passing variable parameters.
Variable parameters are only available for VFormat, which will significantly increase the complexity of the code in some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants