Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.39 KB

compiler-warning-level-3-c4738.md

File metadata and controls

48 lines (36 loc) · 1.39 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (Level 3) C4738
Compiler Warning (Level 3) C4738
11/04/2016
C4738
C4738
9094895f-7eec-46c2-83d3-249b761d585e

Compiler Warning (Level 3) C4738

storing 32-bit float result in memory, possible loss of performance

C4738 warns that the result of an assignment, cast, passed argument, or other operation may need to be rounded or that the operation ran out of registers and needed to use memory (spilling). This can result in performance loss.

To resolve this warning and avoid rounding, compile with /fp:fast or use double instead of float.

To resolve this warning and avoid running out of registers, change the order of computation and modify your use of inlining

This warning is off by default. For more information, see Compiler Warnings That Are Off by Default.

Example

The following sample generates C4738:

// C4738.cpp
// compile with: /c /fp:precise /O2 /W3
// processor: x86
#include <stdio.h>

#pragma warning(default : 4738)

float func(float f)
{
    return f;
}

int main()
{
    extern float f, f1, f2;
    double d = 0.0;

    f1 = func(d);
    f2 = (float) d;
    f = f1 + f2;   // C4738
    printf_s("%f\n", f);
}