‘noreturn’ function does return

前端 未结 2 1673
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 02:53

When I compile the C program below, I get this warning: ‘noreturn’ function does return. This is the function:

void hello(void){
  int i;
  i=1;         


        
2条回答
  •  被撕碎了的回忆
    2021-01-12 03:30

    Most probably, the function is marked with __attribute__((noreturn)). However, it does in fact return (when control reaches the end of irs body, since it doesn't enter an infinite loop, it doesn't call other "noreturn" functions, etc.)

    I don't see what your point is in 1. marking the function as non-returning, 2. writing a function that does nothing - probably you could just eliminate both?

提交回复
热议问题