Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 798 Bytes

compiler-warning-level-4-c4204.md

File metadata and controls

36 lines (30 loc) · 798 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4204
Compiler Warning (level 4) C4204
11/04/2016
C4204
C4204
298d2880-6737-448e-b711-15572d540200

Compiler Warning (level 4) C4204

nonstandard extension used : non-constant aggregate initializer

With Microsoft extensions (/Ze), you can initialize aggregate types (arrays, structures, unions, and classes) with values that are not constants.

Example

// C4204.c
// compile with: /W4
int func1()
{
   return 0;
}
struct S1
{
   int i;
};

int main()
{
   struct S1 s1 = { func1() };   // C4204
   return s1.i;
}

Such initializations are invalid under ANSI compatibility (/Za).