[NTG-pdftex] C style

Martin Schröder martin at oneiros.de
Wed Dec 28 02:40:00 CET 2005


On 2005-12-27 21:27:01 +0100, Olaf Weber wrote:
> Taco Hoekwater writes:
> > I've always disliked the GNU "etags-is-too-stupid-for-anything-else"
> > function headers that break over a line, like:
> 
> >    int
> >    main (int argv, argc**)
> 
> That's not about etags, it's about grep, in particular the ability to
> do "grep ^foo *.c" and find the defn of foo().  Apart from the space

Ah. Agreed.

> (which is abominable) after the function name, I have learned to

The space is not configurable in the declaration -- only after
every function call. And I prefer to have it after calls.

On 2005-12-27 09:39:39 +0100, Hartmut Henkel wrote:
> do we really want GNUish indentation? like
> 
>   if (strcmp (fp->tfm_name, nontfm) != 0)
>     {
>       p = (fm_entry *) avl_find (tfm_tree, fp);
>       if (p != NULL)
>         {
>           if (mode == FM_DUPIGNORE)
> 
> i would prefer K&R (--k-and-r-style):
> 
>     if (strcmp(fp->tfm_name, nontfm) != 0) {
>         p = (fm_entry *) avl_find(tfm_tree, fp);
>         if (p != NULL) {
>             if (mode == FM_DUPIGNORE) {

I suggest a tamed k&r:

--k-and-r-style
--blank-lines-after-procedures
--line-length 80
--procnames-start-lines
--space-after-procedure-calls
--no-tabs                       /* this does not work in indent 2.2.6 :-( */
--preprocessor-indentation 2    /* this is new in indent 2.2.9 */

this gives
    if (strcmp (fp->tfm_name, nontfm) != 0) {
        p = (fm_entry *) avl_find (tfm_tree, fp);
        if (p != NULL) {
            if (mode == FM_DUPIGNORE) {

Best
    Martin
-- 
                    http://www.tm.oneiros.de


More information about the ntg-pdftex mailing list