D15532: [Astyle] Add Objective C to list of languages with formatters

Aaron Puchert noreply at phabricator.kde.org
Fri Sep 21 22:45:19 BST 2018


aaronpuchert added a comment.


  In D15532#329308 <https://phabricator.kde.org/D15532#329308>, @rjvbb wrote:
  
  > > We could activate `-Wunreachable-code` so the compiler tells you where `break` isn't needed.
  >
  > Evidently I was talking about a general principle, not about introducing a dependency on the compiler telling you what (not) to do. If I wanted that I'd be coding in Modula-2 ...
  
  
  Eventually we have to compile our code anyway, so aren't we all dependent on the compiler? I'm not sure why you're bringing Modula-2 into the discussion, but C++ is very much about compile-time analysis, in fact I'd say it's one of the main reasons to use it. (Also because it's fast, but that has something to do with compile-time analysis as well.)
  
  With KDevelop's nice integration of compiler warnings it usually doesn't hurt to turn on `-Weverything`. It helps me see a lot of issues that I'd probably overlook otherwise.
  
  If you don't want your compiler to tell you what (not) to do, use a language that isn't compiled.

INLINE COMMENTS

> kossebau wrote in astyle_plugin.cpp:36
> Not yet firm with constexpr myself, so curious to learn what would one gain from using `static constexpr char[]` here? What exactly would be buildtime evaluated?
> I think I have seen constexpr already in KDevelop code, so if that is a better version, would be interested to improve all similar places.

Basically `constexpr` forces compile-time evaluation, which means that

1. The variable will (almost certainly) land in a read-only segment.
2. There is no dynamic initialization order fiasco.

In this case it wouldn't make much of a difference, since it is a compile-time constant and the compiler will treat is as such. But with `constexpr` you get a compilation error if it isn't.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D15532

To: rjvbb, #kdevelop, kossebau, kfunk
Cc: aaronpuchert, kfunk, pino, kossebau, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180921/1d85ef4c/attachment-0001.html>


More information about the KDevelop-devel mailing list