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