Re: how could "atof" be so slow in vc2005?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Don't quite qet what you mean here. If it didn't know the prototype,
how would it know what the function did?

The compiler never knows what "extern" functions do, it just generates
references which the linker must resolve.

In the "C" language (not C++), it is possible to call a function without a
prototype. The parameter types are inferred from usage and the return type
is assumed to be an int (in EAX because the calling convention is assumed to
be cdecl on x86). If the function really returns a double, it uses the FPU
stack to do so. The compiler would not know that, however, but instead use
the value of EAX in the expression, generating the wrong result.

None of this applies to C++, thankfully (although if you use command line
options for calling conventions instead of specifying per-function, you can
get similar problems).


.



Relevant Pages

  • Re: how could "atof" be so slow in vc2005?
    ... The compiler never knows what "extern" functions do, ... The parameter types are inferred from usage and the return ... type is assumed to be an int (in EAX because the calling convention is ... but instead use the value of EAX in the expression, ...
    (microsoft.public.vc.language)
  • Re: how could "atof" be so slow in vc2005?
    ... The compiler never knows what "extern" functions do, ... The parameter types are inferred from usage and the return ... type is assumed to be an int (in EAX because the calling convention is ... but instead use the value of EAX in the expression, ...
    (microsoft.public.vc.language)
  • Re: how could "atof" be so slow in vc2005?
    ... The compiler never knows what "extern" functions do, ... The parameter types are inferred from usage and the return ... type is assumed to be an int (in EAX because the calling convention is ... but instead use the value of EAX in the expression, ...
    (microsoft.public.vc.language)
  • Re: C/C++ Compilers Optimization Failed
    ... I used C/C++ Compiler's Optimization. ... >> xor eax, eax ... I am shocked that C/C++ Compiler did not tune optimization very well ...
    (comp.lang.asm.x86)
  • Re: missing optimization?
    ... Both, function1 and function2, have duplicated ... > movl _data, %eax ... > subl 4, %eax ... > If compiler is *newer* than 2.95, then it puts the TEST opcode. ...
    (comp.os.msdos.djgpp)