it works for me (although still with some warnings, but...i'm a newbie, have no idea), test passed:
Ran 10 tests in 2.036s
OK
follow-up QAs:
Q: but this works without the above error on wsl, do different os treat the code of this function differently?
chatgpt:
Yes, different operating systems and compilers can treat code differently, especially when it comes to variable length arrays (VLAs). VLAs are part of the C99 standard and supported by GCC and Clang, but not by older versions of the Microsoft Visual C++ (MSVC) compiler.
In your case, the error occurs because MSVC does not support VLAs. On WSL (Windows Subsystem for Linux), GCC or Clang, which do support VLAs, are typically used, allowing the code to compile and run without issues.
To ensure compatibility across different compilers and platforms, it is best to avoid VLAs and use dynamic memory allocation instead, as demonstrated in the previous response. This approach makes your code more portable and ensures it works consistently on different systems and compilers.
basic info:
runing
pyhton setup.py install
raised below errors:chatgpt provided a solution that the below should be used (dynamically memory allocation):
it works for me (although still with some warnings, but...i'm a newbie, have no idea), test passed:
follow-up QAs: Q: but this works without the above error on wsl, do different os treat the code of this function differently? chatgpt: