bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Bug-indent] No space before `*' in declarations


From: Pavel Roskin
Subject: RE: [Bug-indent] No space before `*' in declarations
Date: Sat, 07 Dec 2002 14:09:27 -0500 (EST)

Hello, David!

> 1) Your previous patch has not been ignored - I just have not had time
> to check it yet.

OK, it's understandable.

> 2) Your patch will just cause another flurry of complaints because
> others do not want indent to change its output the way you do. To have
> this style supported will need a switch to set it on for those who do
> want it and leave things the way they are for the rest.

I disagree.  If the asterisk in the arguments is interpreted as a binary 
operation, then it's a bug.

The "bugward-compatible" style would mean that we intentionally add space 
for typedefs but not for structures:

int foo (foo_t * a, struct bar *b);

That's not a style - it lacks consistency.  Of course, we would be in a 
better position if the fix was done in lexi.c - then it would be a clean 
bugfix.

> 3) Have you read-up and tried the -T option to tell indent that "foo_t"
> is a type that should be treated the same as char and the like?

For GNU Midnight Commander we have this:

$ find -name '*.h' -exec grep '\<typedef\>' {} \; | wc -l
    441

That's quite a lot.

More thoughts about the right fix.  Binary operations should be allowed in 
brackets, but not on the top level of the arguments:

int foo (foo_t *array[4 * BUF_SIZE]);

I think that the function arguments should be split by commas and the
resulting parts should be formatted as declarations.  Some declarations
can be invalid outside function arguments, e.g. when the variable name is
missing:

int foo (foo_t *, bar_t *);

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]