linux/unix and makefiles -


Create a file in Linux:
I want to run the output program only in case of successful compilation.

Is there any way to do this?

As told by others, & amp; & Amp; . For example:

  $ tax & amp; ./a.out  

There are two things that this works; First of all, there is a conference in UNIX that all the things that are successful in return 0 (including the C programs). There is an old joke that helps you to remember "The Roman Empire fell, because the Romans did not have zero, with which they could successfully finish their program".

Second, & amp; Amp; & Amp; Amp; Boolean is a "short circuit" version and "that is, the evaluation of this expression on its left side and only if it is 0 , it will evaluate the expression on the right. This is Java operators < There is a difference between code> & amp; amp; (short circuit) and & amp; (always evaluates both operands). In many compulsory languages ​​there are two types of operators , If Boolean expression is in the right hand operation If there are side effects (like I / O, variable updates), in this case you definitely want to evaluate both operands. Some people, however, would say that this bad style to embed such side effects


Comments