[petsc-dev] reminder about initializing structs

Jed Brown jedbrown at mcs.anl.gov
Thu Nov 21 20:57:22 CST 2013

Barry Smith <bsmith at mcs.anl.gov> writes:

>   You can’t do this in C89, so please don’t do this in PETSc code since someone (me, will have to fix it later) 
> src/dm/impls/da/dalocal.c: In function ‘DMDASetVertexCoordinates’:
> src/dm/impls/da/dalocal.c:1192:5: warning: initializer element is not computable at load time [enabled by default]
>      PetscInt ind[3] = {0, 0, k + da->zs}, d, off;

Do any compilers actually reject this, or only warn with -std=c89?  The
struct syntax is more compact and easier to read.  I assume that
Microsoft will eventually completely drop support for their C compiler,
and then there will be no reason not to use basic C99 features.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131121/557d7488/attachment.sig>

More information about the petsc-dev mailing list