Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I'm sure someone else can provide a more comprehensive answer than I could, Just a few things:

  • string::at throws an out-of-range exception, since you're not actually catching anywhere, I'd use [] since at() is slower slower and you're already checking the string length, not that it really matters that much for this simple code though.

  • I would factor out the std::wstring(argv[1]) and similar into local variables so there are fewer brackets.

  • if statements without braces are less maintainable less maintainable.

  • wmain is windows specific, so this code won't compile elsewhere.

I'm sure someone else can provide a more comprehensive answer than I could, Just a few things:

  • string::at throws an out-of-range exception, since you're not actually catching anywhere, I'd use [] since at() is slower and you're already checking the string length, not that it really matters that much for this simple code though.

  • I would factor out the std::wstring(argv[1]) and similar into local variables so there are fewer brackets.

  • if statements without braces are less maintainable.

  • wmain is windows specific, so this code won't compile elsewhere.

I'm sure someone else can provide a more comprehensive answer than I could, Just a few things:

  • string::at throws an out-of-range exception, since you're not actually catching anywhere, I'd use [] since at() is slower and you're already checking the string length, not that it really matters that much for this simple code though.

  • I would factor out the std::wstring(argv[1]) and similar into local variables so there are fewer brackets.

  • if statements without braces are less maintainable.

  • wmain is windows specific, so this code won't compile elsewhere.

Source Link

I'm sure someone else can provide a more comprehensive answer than I could, Just a few things:

  • string::at throws an out-of-range exception, since you're not actually catching anywhere, I'd use [] since at() is slower and you're already checking the string length, not that it really matters that much for this simple code though.

  • I would factor out the std::wstring(argv[1]) and similar into local variables so there are fewer brackets.

  • if statements without braces are less maintainable.

  • wmain is windows specific, so this code won't compile elsewhere.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /