In C, what does “public” mean when put before a global variable?

后端 未结 4 1341
[愿得一人]
[愿得一人] 2021-01-13 12:38

I\'m going through the source code of the \"less\" unix tool by Mark Nudelman, and the beginning of main.c has many of the following:

public int  logfile = -         


        
4条回答
  •  暖寄归人
    2021-01-13 13:18

    The definition of public as an empty pre-processor macro has been addressed in other answers. To find the definition, you probably want to use a tool like ctags/etags or cscope. (There are many tools to scan a source tree to generate this information.) For example, you can find the definition of public at line 55 of less.h by invoking:

    $ ctags -dtw *.c *.h
    $ vi -t public
    

    Or, simply run ctags before you start editing anything. When you see a definition you don't understand, put the cursor on it and type ^] (that's control-right square bracket, and will work in vi-like editors.)

提交回复
热议问题