What makes..._attribute______noreturn_______) in sy



  • I found an expression in Linux API.

    #define NORETURN __attribute__((__noreturn__))
    

    Can someone explain how this works?



  • There are some functions where the programme is no longer returning. Like abort or longjump. Such functions are usually marked with similar attributes so that the compiler (as well as the code analysers) know about this particularity and do not ask questions, and may write a little more optimum/right code.

    And your define is a common practice, the fact is that most of these attributes depend heavily on the compiler. And whatever it takes to write a bunch of #ifdef, it's like athributums, and it's a collection system (or one hedge) that makes the right values for the chosen compiler/media.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2