A function to write several digital outputs at once (C++ level)

In which case, you probably don't want to start the for loop in the function from 0 ...