|
Bugzilla – Full Text Bug Listing |
| Summary: | Command Line Parser treats uint8_t as char | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Jörg Christian Kirchhof <christian.kirchhof> |
| Component: | core | Assignee: | Peter Barnes <pdbarnes> |
| Status: | RESOLVED MOVED | ||
| Severity: | normal | CC: | ns-bugs, sebastien.deronne, tomh |
| Priority: | P3 | ||
| Version: | ns-3.28 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://www.nsnam.org/bugzilla/show_bug.cgi?id=2904 | ||
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 |
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.