Hi! What should be used for type declarations: typedef or using? typedef is there because of historical reasons, but LLVM code based is C++11 now. LLVM Coding Standards are not clear on this matter. Eugene. Clang-tidy has modernize-use-using, but fix-it functionality is not perfect (https://llvm.org/bugs/show_bug.cgi?id=28334).
Joerg Sonnenberger via llvm-dev
2016-Sep-07 23:50 UTC
[llvm-dev] typedef or using in C++ code
On Wed, Sep 07, 2016 at 04:30:01PM -0700, Eugene Zelenko via llvm-dev wrote:> What should be used for type declarations: typedef or using? typedef > is there because of historical reasons, but LLVM code based is C++11 > now. > > LLVM Coding Standards are not clear on this matter.Can you give some context for the situation you wonder about? They are both valid in some situation. Joerg
Piotr Padlewski via llvm-dev
2016-Sep-08 00:19 UTC
[llvm-dev] typedef or using in C++ code
I prefer to use using instead of typedef in new code. 2016-09-07 16:50 GMT-07:00 Joerg Sonnenberger via llvm-dev < llvm-dev at lists.llvm.org>:> On Wed, Sep 07, 2016 at 04:30:01PM -0700, Eugene Zelenko via llvm-dev > wrote: > > What should be used for type declarations: typedef or using? typedef > > is there because of historical reasons, but LLVM code based is C++11 > > now. > > > > LLVM Coding Standards are not clear on this matter. > > Can you give some context for the situation you wonder about? They are > both valid in some situation. > > Joerg > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160907/7aba5b7c/attachment.html>
> On Sep 7, 2016, at 4:50 PM, Joerg Sonnenberger via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On Wed, Sep 07, 2016 at 04:30:01PM -0700, Eugene Zelenko via llvm-dev wrote: >> What should be used for type declarations: typedef or using? typedef >> is there because of historical reasons, but LLVM code based is C++11 >> now. >> >> LLVM Coding Standards are not clear on this matter. > > Can you give some context for the situation you wonder about? They are > both valid in some situation.Are there cases were typedef is (technically) preferable (or needed) compared to using? — Mehdi