[Qt-creator] Formatting of "using" with structs

Andy asmaloney at gmail.com
Sat Oct 20 14:15:05 CEST 2018


Thanks André.

Yes, I suppose that's true! Did I mention how old some of this code is? :-)

This might be a good case for clang-tidy (if it doesn't already exist).
Right now it recommends "using".

Even doing that I get something a little off - two indents instead of one:

   struct FooInfo

   {

         QString  name;

         QString  code;

   };


I assume this has to do with the setting for public/private indentation,
though I would expect if those keywords aren't present it wouldn't add the
extra indent.

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>



On Sat, Oct 20, 2018 at 5:40 AM André Pönitz <apoenitz at t-online.de> wrote:

> On Fri, Oct 19, 2018 at 06:50:57AM -0400, Andy wrote:
> > I've been updating some of my code from "typedef" to "using" style:
> >
> >    typedef int foo;
> >
> >    using foo = int;
> >
> >
> > When I try it with structs though the formatting gets all messed up in
> > Creator:
> >
> >    using FooInfo = struct
> >
> >    {
> >    QString  name;
> >    QString  code;
> >
> > };
>
>
> Given that this is C++, not C, the canonical way to write this would be
>
>     struct FooInfo
>     {
>         QString  name;
>         QString  code;
>     };
>
> i.e. neither typedef nor using.
>
> Andre'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20181020/b29aa340/attachment.html>


More information about the Qt-creator mailing list