[Top][All Lists]

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

Re: CC-mode highlight change between 24.5 and 25

From: Alan Mackenzie
Subject: Re: CC-mode highlight change between 24.5 and 25
Date: Fri, 2 Sep 2016 14:31:03 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Oleh.

On Fri, Sep 02, 2016 at 04:18:28PM +0200, Oleh Krehel wrote:
> Alan Mackenzie <address@hidden> writes:

> > Can you help me out here, please - by what criterion is the C++ compiler
> > deciding that `fout' is a variable initialised to `file_name' rather
> > than a function declaration?  The only syntactic thing I can see for
> > this is that `fout' is declared inside a function rather than at the top
> > level (or directly inside a class, struct, or namespace).

> I think it very uncommon to declare a function inside another function
> in C++: it's done in top-level instead.

Is it even valid C++?

> I would be happy enough with the heuristic of parsing all indented
> (i.e. not top-level) declarations/definitions as (variable) definitions.

Hmm.  Functions are also declared within class definitions, and are
frequently indented there.  Likely also within namepaces, at least

At the moment, I'm looking at somehow tracking whether or not a possible
declaration is at "top-level" or not (where "top-level" includes being
directly inside a class or namespace), by counting braces and noting the
pertinent keywords ("class", "struct", "namespace", and maybe one or two
others).  There is already a function c-at-toplevel-p which determines
this, but that would be ruinously slow in the sort of tight loop we're
dealing with here.

>     Oleh

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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