Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-11 Thread Richard Tran Mills via petsc-dev
I'll just add my vote: +1 to supporting the intersection of C99, C11, C++11, and later standards. Also +1 to sadness that VLAs don't fall into there. (Though I understand the reasons why compiler developers might not want to support them.) --Richard On 3/11/20 8:34 AM, Jed Brown wrote: My

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-11 Thread Jed Brown
Lisandro Dalcin writes: > 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 typeof isn't in any standard, including proposed (-std=c2x). You can use __typeof as

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-11 Thread Lisandro Dalcin
On Wed, 11 Mar 2020 at 18:34, Jed Brown 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

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-11 Thread Jed Brown
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. Jeff Hammond

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-10 Thread Jeff Hammond
I wonder if it is not more useful to talk in terms of C11 features. Unlike C99, C11 makes VLAs optional via __STDC_NO_VLA__, so you have a standardized way of expressing the subset of C11 that is compatible with C++11. __STDC_NO_ATOMICS__ and __STDC_NO_THREADS__ play a similar role. Of course,

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-09 Thread Lisandro Dalcin
On Sat, 7 Mar 2020 at 08:48, Jed Brown wrote: > I have a question for petsc-dev: Do you know anyone who needs to build > PETSc with a compiler that doesn't support variadic macros and for-loop > declarations? (Both of these are in C99 and C++11, and supported by all > tested configurations

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-09 Thread Junchao Zhang via petsc-dev
On Sat, Mar 7, 2020 at 8:45 AM Jed Brown wrote: > Satish Balay writes: > > > On Fri, 6 Mar 2020, Jed Brown wrote: > >> PetscInt some,several,variables; > >> > >> // code > >> if (PetscDefined(HAVE_MAGIC)) { > >> function(several,); > >> } > >> use(some,variables); > > > > One

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Satish Balay via petsc-dev
On Sat, 7 Mar 2020, Jed Brown wrote: > Satish Balay writes: > > > On Fri, 6 Mar 2020, Jed Brown wrote: > >> PetscInt some,several,variables; > >> > >> // code > >> if (PetscDefined(HAVE_MAGIC)) { > >> function(several,); > >> } > >> use(some,variables); > > > > One minor issue:

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Jed Brown
Satish Balay writes: >> +1 for the for-loop declarations. >> >> No more need to police the use of // C++-style comments? > > I think the objection was more about the code style. Mixing both types of > comments does not look good. I don't have a problem with // for one-line comments and /* */

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Jed Brown
Satish Balay writes: > On Fri, 6 Mar 2020, Jed Brown wrote: >> PetscInt some,several,variables; >> >> // code >> if (PetscDefined(HAVE_MAGIC)) { >> function(several,); >> } >> use(some,variables); > > One minor issue: we haven't yet fixed up clang analyzer build. Likely this >

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Satish Balay via petsc-dev
On Sat, 7 Mar 2020, Patrick Sanan wrote: > Perhaps naively, I‘d assume that while there may well be someone out there > relying on compilers for which this would be a problem, that same person is > also less likely to be able to upgrade PETSc. > > The benefits seem well worth it. It‘ll make

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Satish Balay via petsc-dev
On Fri, 6 Mar 2020, Jed Brown wrote: > I have a question for petsc-dev: Do you know anyone who needs to build > PETSc with a compiler that doesn't support variadic macros and for-loop > declarations? (Both of these are in C99 and C++11, and supported by all > tested configurations including

Re: [petsc-dev] Request for comments: allow C99 internally

2020-03-07 Thread Patrick Sanan
Perhaps naively, I‘d assume that while there may well be someone out there relying on compilers for which this would be a problem, that same person is also less likely to be able to upgrade PETSc. The benefits seem well worth it. It‘ll make things just that much easier to work with. +1 for the

[petsc-dev] Request for comments: allow C99 internally

2020-03-06 Thread Jed Brown
I have a question for petsc-dev: Do you know anyone who needs to build PETSc with a compiler that doesn't support variadic macros and for-loop declarations? (Both of these are in C99 and C++11, and supported by all tested configurations including compilers that don't fully implement these