Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tools using function names in the first column

Tags:

c

coding-style

The GNU coding standards document says:

It is also important for function definitions to start the name of the function in column one. This helps people to search for function definitions, and may also help certain tools recognize them. Thus, using Standard C syntax, the format is this:

static char *
concat (char *s1, char *s2)
{
    ...
}

Are tools that benefit from this convention, currently in significantly widespread use?

Note that I'm not asking whether this convention is better than others in terms of readability or aesthetics - that's largely a matter of opinion - only whether tools that benefit from it, are still used.

like image 838
rwallace Avatar asked Nov 16 '25 05:11

rwallace


2 Answers

grep may use this convention:

$ grep '^concat (' *.c

And similarly for other regex-based tools, including every serious editor on Unix.

like image 144
Fred Foo Avatar answered Nov 18 '25 20:11

Fred Foo


i think that citing grep is enough . Having the function name alone in a row allow to easy locate it without using complex regex. Anyway tool like cscope can perform this job for every formatting convention you would use.

like image 20
Heisenbug Avatar answered Nov 18 '25 19:11

Heisenbug



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!