Using spans instead of raw pointers helps to differentiate ararys from pointers to single elements, gives bounds checking in debug builds, and conveniently stores the number of elements in the same variable. Also make variable naming consistent. For example, use `loops` instead of `mloop`. The plural helps to clarify that the variable is an array. I didn't change positions because there is a type mismatch between C and C++ code that is ugly to manage. All remaining code can be converted to C++, then that change will be simpler. Pull Request #105138