The information in this article applies to:
SYMPTOMSWhen Microsoft C/C++ compiles an application that specifies a structure in the default arguments for a function, the compilation fails with the following error messages:
CAUSEAccording to the C++ grammar, the default value for an argument must be an expression. An initializer list, such as that used to initialize a structure, is not an expression. RESOLUTIONDefine a constructor to perform the required initialization. MORE INFORMATIONThe first code example demonstrates the errors listed above. The second code example demonstrates the correct method to initialize the structure. Code Sample 1Code Sample 2
Additional query words: 8.00 8.00c 9.00 9.10
Keywords : kbCompiler kbCPPonly kbVC100 kbVC150 kbVC151 kbVC152 kbVC200 kbVC210 kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 |
|
Last Reviewed: July 15, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |