help-gnu-emacs
[Top][All Lists]
Advanced

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

formatting function argument list


From: Timur Aydin
Subject: formatting function argument list
Date: Sun, 25 May 2003 23:47:57 +0300
User-agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (gnu/linux)

Hi,

There are many functions in our C/C++ source tree which have their
argument lists messed up in terms of formatting/alignment. Part of the
problem is that both tabs and spaces have been used. For example:

int func(   int                a,
          int        b,
           size_t c)
{
   /* Function body (currently fubar in terms of indentation) */
}

After marking the whole function and doing C-M-\, here is what I get:

int func(int                a,
         char        b,
         size_t c)
{
   /* Function body (nicely indented) */
}

The function body is formatted appropriately and all tabs are
gone. But the whitespace in the function argument list still needs to
be dealt with. Any suggestions on how to format it? Here are some
examples that I can think of:


/* All arguments in one line, one space between type and argument */
int func(int a, char b, size_t c)
{
   /* Function body (nicely indented) */
}

/* One argument per line, one space between type and argument */
int func(int a,
         char b,
         size_t c)
{
   /* Function body (nicely indented) */
}


/* One argument per line, arguments aligned. */
int func(int    a,
         char   b,
         size_t c)
{
   /* Function body (nicely indented) */
}

-- 
Timur Aydin


reply via email to

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