+ 5

SoloLearn C Compiler! The Code that used to run well, not anymore !!! 😔

SoloLearn Compiler seems not too good for C codes! I occasionally encounter with Error messages when run my C codes in SoloLearn. It's so strange when I refer to my old C codes that worked and did run perfectly in the past, now I see this "the monitored command dumped core" when running the code!!!!! 🤷 Is there anyone to help me please, I'm really going to lose my mind 😒

26th Dec 2020, 2:35 AM
H. Ahmadian
H. Ahmadian - avatar
34 Réponses
+ 14
H. Ahmadian 1) sololearn use gcc to compile codes ( which is a fairly standard compiler ) and the warning are generated by it during compile-time 2) the problem you are facing is due to the fact that sololearn ( like most of the server side online IDEs ) have capped the execution time of a program, means it will only give your program limited time to execute (roughly 4-5 sec) exceeding wich it will leads to undefined behaviour (like "no output" "timeout error" "time limit exceeded" "command dumped core" etc) When I Am Groot ! edited your program, he removed those compiler warnings as well as optimised the code a bit making it faster and thus sometimes giving desired output. 3) your second program is not working because <conio.h> is deprecated from standards now
26th Dec 2020, 4:26 AM
Arsenic
Arsenic - avatar
+ 8
H. Ahmadian I think the difference with web codes is that, they run on your device instead of their server. They allocate a limited time just so all of the compile/run requests are fullfilled. You would not want all the time and resources to be consumed by some infinite loop and let all the other codes wait for their turn.
26th Dec 2020, 4:49 AM
Arsenic
Arsenic - avatar
+ 7
H. Ahmadian After spending 1:30 hours finally solved the issue. In your code there is only one issue. There should be EOF instead of '\n' https://code.sololearn.com/cx8kjmrlwrpB/?ref=app -------- You can't call realloc like this: realloc(number,(sizeof(char))); -------- The correct way to call realloc is like this: temp = realloc(number,(sizeof(char))); You need to assign realloc in a temp variable
26th Dec 2020, 5:55 AM
A͢J
A͢J - avatar
+ 5
H. Ahmadian You are busy in arguing. Did you see what was the mistake in your code? I told you with a corrected code but you didn't say anything and just busy in arguing and blaming SoloLearn C compiler.
28th Dec 2020, 2:43 AM
A͢J
A͢J - avatar
+ 4
H. Ahmadian There is no doubt your code worked well 1 years ago but might be Sololearn changed compiler.
26th Dec 2020, 3:47 AM
A͢J
A͢J - avatar
+ 4
H. Ahmadian Can't say.
26th Dec 2020, 3:53 AM
A͢J
A͢J - avatar
+ 4
Also C is a very fast language so I think it is good to have a time limit for learners as it will force them to think of a faster and more optimised way to solve a problem then just brute forccing all.
26th Dec 2020, 4:50 AM
Arsenic
Arsenic - avatar
+ 4
H. Ahmadian Your code is also working. You just have to change getchar()) != '\n' To getchar()) != EOF
26th Dec 2020, 6:04 AM
A͢J
A͢J - avatar
+ 4
H. Ahmadian I can see even clearly now, how your self pride had blinded you from the fact that even you can make mistakes. What is even GCC agent? do you even know GNU that you can say they need "agents" You don't offend me, it takes loads of times more to get to offend me. Of course, you can also start a campaign against SoloLearn and GCC anywhere you please. I'd be pleased to see what others has to say about your claim once they find the truth. And lastly, even if I have an idea of correction or improvement, believe me I'd rather keep it to myself, cause I see no point to bring it out. I'm leaving this thread, best of luck with your pride 👍
26th Dec 2020, 3:56 PM
Ipang
+ 3
H. Ahmadian Share your code here.
26th Dec 2020, 2:40 AM
A͢J
A͢J - avatar
+ 3
H. Ahmadian Yes she is right. Void is not supported now. When I assigned realloc to some variable then it worked. Though output is not coming but also errors are not coming. https://code.sololearn.com/cx8kjmrlwrpB/?ref=app
26th Dec 2020, 3:40 AM
A͢J
A͢J - avatar
+ 3
I Am Groot ! Modifying the code does not seem to make sense 🤷
26th Dec 2020, 3:54 AM
H. Ahmadian
H. Ahmadian - avatar
+ 3
H. Ahmadian try a relatively smaller input to decrease overall runtime. For example :- Your second program after removing <conio.h> gives desired output when tested with following input :- 1 10
26th Dec 2020, 4:43 AM
Arsenic
Arsenic - avatar
+ 3
H. Ahmadian Millions of C developers will disagree to your negative claim about gcc, even worse when they see your code. If you insist on the motive of pointing finger at everything but your mistake, then you are putting yourself as an image of perfection which needs no correction, because every problem is caused by something/someone else. I'm sorry to say this, but such attitude is one that helps *not* to grow.
26th Dec 2020, 7:50 AM
Ipang
+ 3
H. Ahmadian about your "Sort String", I don't see how heap-allocated memory is increasing efficiency. In addition, there was no step to free those heap memory. I think calling malloc & co. in loop this way won't increase the performance. It's always better to avoid heap-allocation if the task can be done using stack memory. that's one of the reasons why C++ brought std::string_view, even though std::string is quite good (but expensive). if the task was just to sort something e.g. "$tar3" -> "$3art", it can be achieved using fewer lines of code (25+- lines). example solution: https://code.sololearn.com/ca158a18a1a2
26th Dec 2020, 6:19 PM
Flash
+ 2
I Am Groot ! Aysha Simra Look at this Code too !!!! The Code that worked very well in the past ! 🤦 https://code.sololearn.com/cGwwqY6H9KYm/?ref=app
26th Dec 2020, 4:01 AM
H. Ahmadian
H. Ahmadian - avatar
+ 2
Arsenic Conclusion: The SoloLearn is only perfect for Web Codes! Not C
26th Dec 2020, 4:43 AM
H. Ahmadian
H. Ahmadian - avatar
+ 2
H. Ahmadian There you go! the "once again you're wrong" part is enough an evidence of an ideology, which has to emphasise that anything and anyone else was to blame when a problem arise. Trust me, after seeing all the denials and the brag abouts (most recently), I wouldn't even want to believe a word saying that self pride doesn't exist. Your second paragraph "I know GNU, as I was part of the Open Source Project in university" is clearly a show off line written in attempt to convince people that you *know* GNU. Although you had clearly accused me earlier, to be a "GCC agent", as if, an agent was even needed. "Honestly I'm happy ..." is a lie. And so is "the pride you're talking about never existed." I am free to choose to contribute or leave a discussion. Too many a good coder here, nothing to be concerned about. And lastly, please do not ping me here, or anywhere again, I'm outta here, getting sick.
26th Dec 2020, 11:12 PM
Ipang
+ 2
Literally this discussion is Ipang and H. Ahmadian arguing.
27th Dec 2020, 8:24 AM
aka :)
aka :) - avatar
0
I Am Groot ! This Code did work perfectly when I wrote it!!! I ran it many many times without error! https://code.sololearn.com/cpH9301rCXQN/?ref=app
26th Dec 2020, 3:18 AM
H. Ahmadian
H. Ahmadian - avatar