Bugzilla – Bug 2916
Command Line Parser treats uint8_t as char
Last modified: 2020-05-04 09:53:44 UTC
Overview: The CommandLine parser treats uint8_t as char. Therefore uint8_t variables get treated unintuitively. Steps to Reproduce: 1) Create a script that uses a uint8_t command line argument: int main (int argc, char *argv[]) { uint8_t seed = 0; CommandLine cmd; cmd.AddValue ("value", "Some Explanation", seed); cmd.Parse (argc, argv); } 2) Run the script with the argument "--value=1" Actual Results: cmd.Parse (argc, argv) sets seed to 49, because 49 is the ASCII value of character '1'. Expected Results: cmd.Parse (argc, argv) should set seed to 1. Build Date & Hardware: ns-3.28 on Mac OS X High Sierra. Additional Information: none.
It would worth to port this one to Gitlab, I've faced this problem again.
Already there :) See https://gitlab.com/nsnam/ns-3-dev/-/merge_requests/235