c99 inline semantics with gcc (mspgcc)

后端 未结 2 1781
逝去的感伤
逝去的感伤 2021-02-10 15:57

I am writing a couple of functions that I would like to inline.

Reading here and using the second c99 inline option with inline on all declarations and definitions, like

2条回答
  •  无人共我
    2021-02-10 16:38

    To ensure that a function ACTUALLY can be inlined, it pretty much has to be defined in the header-file.

    When you don't do that, most compilers won't actually inline the function.

    So my suggestion would be to move the actual function content into the header file:

    inline void SPFD54124B_write_cmd(uint16_t command)
    {
        spi_write(command, CMD_WIDTH);
    }
    

提交回复
热议问题