Counting the API arguments…
2024-8-8 05:59:28 Author: www.hexacorn.com(查看原文) 阅读量:9 收藏

Today Matt posted a half-joking twit about the acceptable number of arguments that can be passed to a function…

I took the challenge VERY SERIOUSLY and decided to investigate.

In my old post I shared my collections of API prototypes that I had extracted from various Microsoft documentation and other sources over the years; so my task was really easy — analyze this data and find the best candidate APIs that meet the criteria.

I first looked at 2004-2007_apis.zip file that included the number of arguments in one of the columns. After merging all this data into a single file, loading it to Excel, and sorting it in a descending order by the number of arguments I immediately got my first candidate:

It takes 17 arguments :-O

I then looked at 2013_apis.zip file as well — this time I had to write a simple script to parse the file and count number of arguments for each function and then save the results to a file. Same as before, I then loaded it to Excel, sored it in a descending order by the number of arguments and now I had my final candidate:

– it takes 21 arguments 🙂

Now, there may be other functions that take even more arguments as an input, but I bet they are quite rare. If you find one tough, please let me know and I will update this post.


文章来源: https://www.hexacorn.com/blog/2024/08/07/counting-the-api-arguments/
如有侵权请联系:admin#unsafe.sh