Do I have a gcc optimization bug or a C code problem?

前端 未结 9 2117
借酒劲吻你
借酒劲吻你 2021-02-06 00:57

Test the following code:

#include 
#include 
main()
{
    const char *yytext=\"0\";
    const float f=(float)atof(yytext);
    siz         


        
9条回答
  •  长发绾君心
    2021-02-06 01:44

    I tested your code with: "i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)"

    and there was no Problem. Output:

    t should be 0 but is 0
    

    So there isn't a bug in you code. That doesn't mean that it is good code. But I would add the returntype of the main-function and the "return 0;" at the end of the function.

提交回复
热议问题