[Top][All Lists]

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

Re: [Bug-indent] C++ ability for indent .. code patch and question.

From: Preston A. Elder
Subject: Re: [Bug-indent] C++ ability for indent .. code patch and question.
Date: Sat, 12 Jan 2002 23:46:18 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20010923

Comments inline:

Carlo Wood wrote:

Aren't there people using a format like:

if (a>b) {


If they are, and they start with:

if (a > b) {
 a = b;

then the resulting code would be:

if (a >b) {

AFIK, theres no option in indent to 'compress space around operators', tho I could be wrong. It will ALWAYS format the above as:
if (a > b) {
never as:
if (a>b) {
no matter what options or input you give it, so I dont see the problem there. This is, infact desirable behavior, since indent is a pretty printer, not an ugly printer ;)

I think that the correct strategy is to never catenate two '>' tokens.
If might be better to add a flag to parser_state_tos that indicates
that the last token was a '<' and then request a space before the
current '<' token if there was also a space before it in the input.

You are correct, more to the point, the correct strategy would be to never concatinate 2 operators (of any kind, not just '<', '>', etc). The only exception I suppose would be '!' (!!strcmp(blah,blah) is valid, bad and ugly, but valid). I did some testing before I made the change, if I put ANYTHING between the operators (be it a comment, some text, pretty much anything really), they would not concatinate together -- so that might help you in you're search for cecation of operator concatination ... I just dont know the code anywhere NEAR well enough to make that kind of change -- my change is indeed, a hack, and I'll be the first to admit it, however, it works :)

Anyway, do with it as you will,

Development Head
Magick IRC Services

Magick IRC Services, power to the PEOPLE!
Product Site: http://www.magick.tm
Project Site: http://www.sourceforge.net/projects/magick

reply via email to

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