nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] Some improvements to the c syntax


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] Some improvements to the c syntax
Date: Mon, 11 Dec 2017 20:24:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0


Op 11-12-17 om 02:58 schreef Liu Hao:
As an example, I had code:

```
#define THROW_LENGTH_ERROR_(message_, field_)   \
     DEBUG_THROW(::Poseidon::Cbpp::Exception,    \
         ::Poseidon::Cbpp::ST_LENGTH_ERROR, ::Poseidon::sslit(   \
             "Length error in message " TOKEN_TO_STR(message_) " \
             while parsing " TOKEN_TO_STR(field_)    \
         ))
```

, then all occurrences of THROW_LENGTH_ERROR_, DEBUG_THROW,
ST_LENGTH_ERROR and TOKEN_TO_STR got colored as red, accompanied with
everything else in cyan.

Yes, such macros are hard to color.  Vim doesn't get it entirely right,
either.  Only Emacs does.  One can't expect nano to get it right.  But
I don't want to, as a cop-out, color the whole macro in the same color.
Macros are too complicated to parse for nano, people will have to live
with it.

Well it depends on how #define is used. Macros are token replacements
that are not always C code. They do not go into object files in any
forms, unless expanded to real C code somehow. When unrolling loops by
hand, interjected macros could be helpful, but it is also necessary to
distinguish macros from plain C code. That is why I think macros should
be colored integrally.

I understand what you mean.  But the most common use of #define is the
assignment of values to tokens, and I don't want to see all the defines
in src/nano.h colored in one color -- it removes a welcome contrast
between #define and token and value.

I propose instead the upcoming patch.

Can you live with that version, Liu?  Or is it no better than what
we have now.

Benno



reply via email to

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