GCC : Static array index in function argument doesn't trigger any warning

前端 未结 2 1658
耶瑟儿~
耶瑟儿~ 2021-01-13 13:08

I\'m trying to understand the use of the \"static\" keyword as an array index in a function declaration in C.

After reading this article, I tried to declare such a f

2条回答
  •  一向
    一向 (楼主)
    2021-01-13 13:44

    It looks like this is a bug in GCC. It seems there were some disagreements regarding whether or not this should be reported at compile time. Nonetheless, it was accepted as a bug but there doesn't seem to be a priority on fixing it.

    This is detailed in bug report 50584. Comment 9 in particular states:

    (In reply to Malcolm Inglis from comment #4)

    Could someone change the status of this bug?

    Notwithstanding whether the feature is pretty or ugly, GCC does accept this code and warnings for undefined behavior, when possible, are desired. Thus, confirmed.

    This does not mean anyone is going to work on fixing this. Please, if you are using this feature and would like to see this warning in GCC, please consider contributing it: https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps

    If you start working on this, it would be good to say so here.

提交回复
热议问题