google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.78k stars 10k forks source link

[Bug]: The value of __argc does not match the actual value of __argv. #4410

Closed Albertweiku closed 8 months ago

Albertweiku commented 8 months ago

Describe the issue

gtest modifies argc, but argc is not modified in msvc When I used ::testing::internal::GetArgvs() in the test program to get the command line arguments, I found that it was not consistent with my expectations. After gtest modifies Argv, argv is also modified accordingly, but __argc remains unchanged. This caused an internal error in my program when judging the number of argv.

Steps to reproduce the problem

On Windows, get argc and argv in test

What version of GoogleTest are you using?

Release 1.14.0

What operating system and version are you using?

Windows10

What compiler and version are you using?

mvsc

What build system are you using?

mvsc

Additional context

No response

derekmauro commented 8 months ago

testing::internal::GetArgvs() is internal to GoogleTest. Do not call it in your program.