This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to divide my complete c code into small c codes.

i have written the C code complied it with 0 error and 0 warnings.

now how can i divide this codes into small c codes in same project.

please help me as i am new to embedded world

Parents
  • #if ralph
    #define fido extern
    #else
    #define fido
    #endif
    
    /*there should be an*/
    #undef ralph
    /*here, to avoid nasty side effects from multiple inclusion
    

    Let's note that most people still using that "trick" actually call that fido "EXTERN" or some variation of that to make it at least marginally self-explaining.

    But it's still a half-baked idea. For starters, it breaks down as soon as you want to have explitly initialized globals use the same scheme. It also upsets various kinds of static analyzers that hate it when the same header expands to different things in different translation units.

Reply
  • #if ralph
    #define fido extern
    #else
    #define fido
    #endif
    
    /*there should be an*/
    #undef ralph
    /*here, to avoid nasty side effects from multiple inclusion
    

    Let's note that most people still using that "trick" actually call that fido "EXTERN" or some variation of that to make it at least marginally self-explaining.

    But it's still a half-baked idea. For starters, it breaks down as soon as you want to have explitly initialized globals use the same scheme. It also upsets various kinds of static analyzers that hate it when the same header expands to different things in different translation units.

Children
No data