Coding Standards for pure C (not C++)

前端 未结 11 1946
盖世英雄少女心
盖世英雄少女心 2020-12-12 14:17

I come from a java background (from my CS classes) and a semester of C++. I am just finishing up a OpenCV project for my Co-Op that\'s in pure C, so I\'m a bit late in aski

11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 15:15

    You can restrict visibility of file-scope variables and functions to their respective source files (although that doesn't prevent you from passing pointers to these objects around).

    For example:

    /** foo.c */
    static void foo_helper() {...} /* foo_helper cannot be called by name 
                                      outside of foo.c */
    static int local_state;        /* local state is visible at file scope,
                                      but is not exported to the linker */
    

提交回复
热议问题