On Wed, 11 Mar 2020 at 18:34, Jed Brown <j...@jedbrown.org> wrote: > My proposal is for PETSc to support the intersection of C99, C11, C++11, > and any later standards. This (sadly*) excludes VLA. > > [*] I don't care about stack allocation, but VLA-pointers are extremely > useful for multi-dimensional array indexing. I'm sad that C11 made that > optional. > > Oh, of course. That's extremely handy, I use it a lot in user/demo code (though not yet in library code) .
My only concerns are stack allocations, it requires developer discipline to not abuse of it. > double (*a)[n] = (double (*)[n])p; > > a[i][j] = 42; > Oh, boy... PS: BTW, if you use typeof() [*], you can simplify these VLA declarations: double (*a)[m][n] = (typeof(a)) p; a[i][j][k] = 42; [*] Don't remember if it is part of C99 or up -- Lisandro Dalcin ============ Research Scientist Extreme Computing Research Center (ECRC) King Abdullah University of Science and Technology (KAUST) http://ecrc.kaust.edu.sa/