Clang vs GCC for my Linux Development project

后端 未结 6 1454
再見小時候
再見小時候 2020-12-22 16:01

I\'m in college, and for a project we\'re using C. We\'ve explored GCC and Clang, and Clang appears to be much more user friendly than GCC. As a result, I\'m wondering what

6条回答
  •  温柔的废话
    2020-12-22 16:32

    For student level programs, Clang has the benefit that it is, by default, stricter wrt. the C standard. For example, the following K&R version of Hello World is accepted without warning by GCC, but rejected by Clang with some pretty descriptive error messages:

    main()
    {
        puts("Hello, world!");
    }
    

    With GCC, you have to give it -Werror to get it to really make a point about this not being a valid C89 program. Also, you still need to use c99 or gcc -std=c99 to get the C99 language.

提交回复
热议问题