Giter VIP home page Giter VIP logo

Comments (2)

Pushpavel avatar Pushpavel commented on June 16, 2024

Hi mym0404, I had no idea that online judges ignore stderr if stdout is right. The current implementation of the local judge ignores stdout if there is anything in stderr. Thanks for bringing it up, love to solve it.

from autocp.

mym0404 avatar mym0404 commented on June 16, 2024

Yes many online judges treats stderr as a error. So programmers remove debugging line before their submission.
But using stderr as useful for debugging in local environment.
For example, this is my template.

#ifdef LOCAL
template<size_t S>
string to_string(const bitset<S> &x) { return x.to_string(); }
string to_string(const string &x) { return '"' + x + '"'; }
string to_string(char x) { return string{'\'', x, '\''}; }
string to_string(bool x) { return x ? "true" : "false"; }
template<class H, class T>
string to_string(const pair<H, T> &x) { return "(" + to_string(x.fi) + ", " + to_string(x.se) + ")"; }
template<class T>
string to_string(T x) {
   string ret = "[";
   for (const auto &i: x) ret += to_string(i) + ", ";
   if (sz(ret) > 1) ret = ret.substr(0, sz(ret) - 2);
   return ret += "]";
}
string to_string(const char *x) { return {x}; }
string to_string() { return ""; }
template<class H, class... T>
string to_string(H h, T... t) { return to_string(h) + ", " + to_string(t...); }
#define debug(...) sizeof( (char[]){#__VA_ARGS__} ) == 1 ? cerr << endl \
: cerr << "[" << #__VA_ARGS__ << "]: " << to_string(__VA_ARGS__) << endl
#else
#define debug(...) 1
#endif

If I define LOCAL only my local machine, then OJ compiler doesn't matter.
It prints debugging line in only my local machine like the following.
image

Also I can submit this code without removing debug(1). Because OJ doesn't define LOCAL macro.

AutoCP is local testing tool and seems to this behavior is incompatible in some case like me.

It will be wonderful if I can use stderr for AutoCP also.

But it is your choice. Because I can configure AutoCP build command like without LOCAL macro and it doesn't need delete code manually for AutoCP testing.

I just suggest this 😀

from autocp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.