c++ - Unable to reduce the code (combine cout with exit) -


i'm allowed insert 10 lines (strict) of codes program. have optimized program concise one. have posted code below.

    if (std::find(outvar.begin(), outvar.end(), line[x].tokens[0]) == outvar.end() ||             (std::find(inputs.begin(), inputs.end(), line[x].tokens[4]) == inputs.end())  {  cerr << "undefined variable " << endl;    exit(1);  }   if (opr[x].type == "mul" && opr[x1].asap_value == my_cycle + 1) { opr[x1].asap_value = my_cycle + 2;  update_slack(); update_matrix(opr[x1].opid, 0); }   if (latency < (opr[p2].asap_value + opr[p2].latency_op - 1) || opr[p2].asap_value == 0)  { cerr << "latency value less circuit \n"; return -1; } 

this alone takes 10 lines , have 2 more compulsory lines of codes has added. i'n unable further reduce it. i'm looking combine err(cout) statement along exit (return) statement single statement.

any appreciated.

thank

you make 1 line using commas:

opr[x1].asap_value = my_cycle + 2, update_slack(), update_matrix(opr[x1].opid, 0); 

not sure if considered cheating. haven't specified rules exactly.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -