INFO: Type float Variable Arguments Are Promoted to Type double (71424)
The information in this article applies to:
- Microsoft C for MS-DOS
- Microsoft C for OS/2
- Microsoft Visual C++ 1.0
- Microsoft Visual C++ 1.5
- Microsoft Visual C++ 2.0
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q71424 SUMMARY
When passing arguments of type float to a function that accepts a variable
number of arguments, those floats not explicitly declared in the prototype
will be promoted to type double.
In this case, the macros va_start and va_arg will use sizeof(float) to
determine the argument size, when the actual size is sizeof(double). This
will give unexpected results because the values on the stack will be
interpreted incorrectly.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbcode kbinfo kbLangC KB71424 |
---|
|