There is nothing strange or unsafe about that usage. The array's size is known at compile time, so it can be used in the loop. This is an example of a template function that allows you to find out the length of an array:
template< class T, std::size_t N >
std::size_t length( const T (&)[N] )
{
return N;
}
Foo f[5];
std::cout << length(f) << "\n";
This should make it clear that you cannot use this technique, or range based loops, on dynamically sized C-style arrays.
Of course, if you have range based loops then you should also have std::array
(if not, you can probably get ti from std::tr1
or boost), so you can avoid the C-style array entirely:
extern std::array<float, 100> bunch;
for (auto &f : bunch) {
f += someNumber;
}