Error flags

I am writing a sketch to create a automated process, and to ensure that each part of the process is correctly completed, I have 4 errorflags whose status change from =0 to =1 when completed.
At the end of each process cycle, I want to read all 4 values, and if one or more of the flags are still =0, then the process is stopped.

I am OK with most of the code, but what is the correct way to write the statement below, my effort seems long winded!!;

if ((errorflagA != 0) || (errorflagB != 0) || (errorflagC != 0) || (errorflagD != 0)) {
.....stop process;
}

Thanks
Paul

Why do you need 4 flags? A counter, incremented each time something successfully completes, will either be 4 or it won't.

That’s not too bad but you could do:-

if ((errorflagA | errorflagB | errorflagC |  errorflagD ) != 0) {

PaulS:
Why do you need 4 flags? A counter, incremented each time something successfully completes, will either be 4 or it won't.

Good idea Paul, that would significantly cut down the coding.
I don't need to know which section 'failed', just that the overall process failed, so yes, thank you.

Paul

I don't need to know which section 'failed', just that the overall process failed

If you did, you could use bitWrite() to write to a byte. The value of the byte would tell you which part failed.

It's a common practice to have 0 as the value when all is fine so you can just :

if(do_stuff())
     error_handling();

So you could just have a byte, initialized as zero. If somewhere you get a error, flip a bit.
Then you can just:

if(my_error_varable) {
     .. handle and figure out wich bit if important
}

Thanks all, I'm going with the increment option.

Paul