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 ).
Can you give some context for the situation you wonder about? They are
both valid in some situation.
Joerg
I prefer to use using instead of typedef in new code.
Are there cases were typedef is (technically) preferable (or needed) compared to using?
template <typename T>
using myVector = vector<T>;
with typedef. But this case is very rare. I prefer to use using always
because IMHO it is cleaner which part is the alias and which is aliasee (if
there is word like this).
Piotr
The question is the opposite: what are the cases where typedef is preferable to using?
(I don’t know any, that’s why I ask.)
bogner
September 8, 2016, 4:15am
#7
Mehdi Amini via llvm-dev <llvm-dev@lists.llvm.org> writes:
bogner
September 8, 2016, 4:16am
#8
Justin Bogner <mail@justinbogner.com> writes:
Mehdi Amini via llvm-dev <llvm-dev@lists.llvm.org> writes:
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?
There's `extern "C"`. Other than that the `using` syntax provides a
struct superset of the functionality. It would be perfectly reasonable
Typo. s/struct/strict/