Should clang and gcc produce a diagnostic message when a program does pointer arithmetic on a function pointer?

后端 未结 2 1347
我在风中等你
我在风中等你 2021-01-22 07:49

This program compiles without errors, for example with clang -Wall -std=c11 a.c and gcc -Wall -std=c11 a.c. Is this a bug in clang and gcc? Because ari

2条回答
  •  太阳男子
    2021-01-22 08:03

    Function pointer arithmetic is a gcc extension also implemented by clang.

    To invoke standards compliance you need

    gcc -std=c11 -pedantic ...
    clang -std=c11 -pedantic ...
    

提交回复
热议问题