Using warning flags with CPH stops the code from executing (VSCode)

Revision en5, by the_commentor, 2021-12-14 00:10:12

TLDR; Would like to use -Wall -Wextra -O2 flags without the warnings interrupting CPH testcases.


Recently, I installed VSCode and was too lazy to set up warning flags. But it came back to bite me and I failed to solve a problem due to an avoidable bug if I had the -Wall flag.

I then proceeded to set up the flags in CPH, but soon noticed an issue. The warnings would stop the testcases from providing an output even if the code was perfectly fine.

Take this following code for example

#include <bits/stdc++.h>
using namespace std;

int main() {
    for (int i = 0; i < 5; i++) cout << i << " "; cout << endl;
    for (int i = 5; i < 9; i++) cout << i << " "; cout << endl;
}

This should output

0 1 2 3 4
5 6 7 8 9

But the compiler thinks that the user meant to add cout << endl; inside the for loop and raises a warning. But this stops CPH from running the testcase, and there is no output.

This is pretty annoying, especially if you're code is just fine.

Are there any workarounds to this issue?

Thanks and regards,
The Commentor

Tags vscode, cph, bug

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English the_commentor 2021-12-14 00:10:12 0 (published)
en4 English the_commentor 2021-12-14 00:09:36 14
en3 English the_commentor 2021-12-14 00:08:44 5
en2 English the_commentor 2021-12-14 00:08:28 405
en1 English the_commentor 2021-12-14 00:04:02 772 Initial revision (saved to drafts)