[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ preferences (was: RFC: lalr1.cc: support move semantics)
From: |
Frank Heckenbach |
Subject: |
Re: C++ preferences (was: RFC: lalr1.cc: support move semantics) |
Date: |
Wed, 12 Sep 2018 23:45:10 +0200 |
Hi Akim!
> >>> I personally don't think "auto x = T (v);"
> >>> adds much compared to "T x = v;" anyway,
> >>
> >> I'm addict to auto almost everywhere. It's way more consistent.
> >
> > I'm more like auto almost almost always. ;) I'm fine with
> > "auto b = false;", but when I have to spell out the type anyway, I
> > think the "auto" form just makes it longer for no benefit. But
> > that's just personal opinion.
>
> Since we're talking about preferences, I'm definitely in favor
> of AAA + westconst.
Same for me WRT westconst, though I first heard this term today. :)
> So my favorite style is definitely
>
> const auto x = T{v};
>
> and I wish I could get rid of auto:
>
> const x = T{v};
I do admit I usually don't declare my local variables const though
they often should be (because I also dislike overly long declarators
that look like Java-style boilerplate, a la
"public static final virtual override const volatile foo ()" ;).
But if there was a more concise syntax, I'd like it. I had
fantasized about a new keyword ("let") or a new syntax (":="), but
if "const" with implied "auto" can simply work, that would be great.
But we're not designing C++ here, I know ...
> >> Likewise, I hate 'typedef' with a passion, so I'm very happy to
> >> use 'using' everywhere. But not an option in lalr1.cc. :)
> >
> > I only slightly prefer "using", and use it in new code, but haven't
> > found a compelling reason to convert "typedef" to "using" in my
> > existing code (though it actually should be quite easy to
> > semi-automate, and the code requires C++14 anyway).
>
> I have used clang-tidy with success to migrate from typedef to using.
> However, some hand tweaks were sometimes needed when it was too
> eager and resolved some type aliases in type aliases (i.e., breaking
> abstractions by revealing the actual types behinds).
I think I could do most cases with regex-replace. As I said, I'm
just looking for a compelling reason to go through all my code; so
far I only do it in code I touch anyway.
Regards,
Frank
- Re: RFC: lalr1.cc: support move semantics, (continued)
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Akim Demaille, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Akim Demaille, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics),
Frank Heckenbach <=
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Akim Demaille, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Akim Demaille, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Akim Demaille, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Frank Heckenbach, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Akim Demaille, 2018/09/15
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Frank Heckenbach, 2018/09/15