Ad
  • Custom User Avatar

    Code ran with warning on local and online compiler with Clang++8.0.1 (was Clang++ freaks out), but that was enough to be treated by Codewars as an error:

    In file included from main.cpp:6:
    ./solution.cpp:16:7: warning: variable 'i' is incremented both in the loop header and in the loop body [-Wfor-loop-analysis]
    i++;
    ^
    ./solution.cpp:12:35: note: incremented here
    for (int i = 0; i < s.size(); i++) {
    ^
    ./solution.cpp:12:23: warning: comparison of integers of different signs: 'int' and 'std::__cxx11::basic_string<char, std::char_traits, std::allocator >::size_type' (aka 'unsigned long') [-Wsign-compare]
    for (int i = 0; i < s.size(); i++) {
    ~ ^ ~~~~~~~~
    2 warnings generated.
    /tmp/main-1368cb.o: In function do_test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)': main.cpp:(.text+0x15): undefined reference to solution(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)