[Kmymoney-devel] Using astyle to beautify the code

Thomas Baumgart thb at net-bembel.de
Fri Mar 26 07:53:43 CET 2010


On Tuesday 16 March 2010 01:45:23 Fernando Vilas wrote:
> On Monday 15 March 2010 18:46:44 Ian Neal wrote:
> >   I've just been looking at the patch that gets generated after running
> > the astyle script and noticed that astyle 1.23 doesn't seem to deal with
> > "foreach" the same way it deals with "for".
> > "foreach" is being treated liked a function so "foreach (expression)"
> > gets formatted as "foreach(expression)", is this what we'd expect/want?
>
> I am not really familiar with the settings for astyle. Before we really go
> into detail, is it possible to isolate the foreach macro from other
> functions and format it as a "for"? If so, we should tailor it to adhere to
> the KDE standard.

I ran through the source of astyle last night while waiting for some (work 
related) deployment to finsih. astyle knows about the foreach keyword, but 
only if the filetype is of C# and not for C/C++. It would be easy to add it 
to the C/C++ path by adding a single line, but that would deviate from the 
astyle source and we would have our own special version. Don't like that 
idea.

Currently, I am thinking of extending the script to take care of it. Shouldn't 
be too hard to change "foreach(" into "foreach (".  If that really doesn't 
work, we could leave it the way it is right now (no blank).

> If there is no KDE standard, I don't think it really matters what we do, as
> long as it is consistent within the project.

-- 

Regards

Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
A clearly defined problem is half the solution!
(found in a chinese fortune cookie)
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 224 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100326/6c89b59f/attachment.sig 


More information about the KMyMoney-devel mailing list