Is it a good idea to eliminate compiler warnings?

前端 未结 14 2716
既然无缘
既然无缘 2021-02-19 01:00

In the past I\'ve worked with -Wall and other switches for gcc to eliminate every compiler warning for projects I\'ve been involved in. Similarly, in Perl, I always program wit

14条回答
  •  感情败类
    2021-02-19 01:27

    There are two compliant prototypes for main in C.

    int main(void)
    

    and

    int main(int argc, char **argv)
    

    void main(void) is not technically correct, although it may be supported by some compilers as an extension to the standard.

    So, in your particular case, you can use a short declaration of main and, if compliant, it won't trigger the warning.

提交回复
热议问题