[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default

Benjamin TERRIER b.terrier at gmail.com
Wed Feb 26 17:43:17 CET 2020


On Fri, 21 Feb 2020 at 09:24, Kai Köhne <Kai.Koehne at qt.io> wrote:

> Hi,
>
> Another alternative is to actually use C++ attributes for this:
>
>   [[qt::emit]] somethingChanged();
>
> C++ attributes are required since C++11, and since C++17 the compiler is
> also required to just ignore one's it doesn't know [1]. Because it is part
> of the core language, It is also something every C++ IDE and tool does
> accept (and could even check for) ...
>

I would like the idea of using attributes for this. However, compilers are
allowed to warn for unknown attributes, which is useful to detect typos.
This means that we would get a warning for each usage of [[qt::emit]]. So
unless there is a way to disable unknown attribute warnings for a specific
set of custom attributes this will be a pain.

My 2 cents

Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200226/63658fe6/attachment.html>


More information about the Development mailing list