On Wed, Nov 19, 2014 at 02:21:30PM +0100, Anselm R Garbe wrote:
> >> types
> >> =====
> >> user defined types start with a capital letter
> >> when possible typedef struct {} Name;
> >
> > Debatable.  I'd like to hear more opinions on this.
> 
> In most suckless code types always start with capital letters (pretty
> much acme/p9 influenced), as opposed to lower case everything else.
> This is much more readable than foo_t, which can be overlooked easily
> to be a type.
> 
> So definitely agree with the proposal.

BTW just a small remark.  I'd like to see the use of typedef to be
limited, perhaps only when we deal with complex declarations.

Consider one possible problem below.

        typedef char wtv[128];

        void
        foo(wtv a)
        {
                printf("%zu\n", sizeof(a)); /* 4 or 8 or whatever */
        }

        int
        main(void)
        {
                wtv a;
                printf("%zu\n", sizeof(a)); /* 128 */
                foo(a);
                exit(0);
        }

The resulting type is an array-type but not in all contexts.

As long as typedef is used sensible I am ok with the proposed naming
convention.

Reply via email to