+ 2
crash on solo learn but not on vs
https://www.sololearn.com/en/compiler-playground/c2vXE7bl12PI Above code does not work on solo learn, but works on visual studio. What is the issue?
9 ответов
+ 4
Ketan Lalcheta
Interestingly, your code compiles using cl.exe, but fails using g++.
There seems to be some error in the sort method that is ignored by cl compiler but gets caught by g++.
cl.exe seems to be less strict with it's compilation.
what compiler were you using?
+ 8
Ketan Lalcheta
By default, VS Code doesn't have a built-in compiler, it uses whatever C++ compiler you have installed on your system like GCC or Clang on Linux/macOS and etc. These compilers handle certain situations differently compared to the compiler used by sololearn
+ 4
Ketan Lalcheta
I modified your code to work for g++ as well aa cl.exe
https://sololearn.com/compiler-playground/cWBv0WeznhPL/?ref=app
+ 2
Ketan Lalcheta ,
the link does not work properly on android devices.
+ 2
It is having dump core
+ 2
Thanks @Bob_Li
I got the idea of missing return statement on sort function. It would have been great to have the error or warning of same, but that's fine.
my code started working with additional line at the end of existing mylist sort() function:
return mylist(head);
Thanks again..!
+ 2
Samson Oloyede ,
please do not post a question inside an already existing post.
it would be better if you start your own question, because people may not be aware of your issue.
+ 1
I am on visual studio 2k17 on windows.so compiler is cl.exe