logoalt Hacker News

flakesyesterday at 6:16 AM4 repliesview on HN

Auto has really made c++ unapproachable to me. It's hard enough to reason about anything templated, and now I frequently see code where every method returns auto. How is any one supposed to do a code review without loading the patch into their IDE?


Replies

OneDeuxTriSeiGoyesterday at 6:29 AM

I'd suppose this really depends on how you are developing your codebase but most code should probably be using a trailing return type or using an auto (or template) return type with a concept/requires constraint on the return type.

For any seriously templated or metaprogrammed code nowadays a concept/requires is going to make it a lot more obvious what your code is actually doing and give you actually useful errors in the event someone is misusing your code.

show 1 reply
themafiayesterday at 6:24 AM

The pain of lisp without any of the joy.

Traubenfuchsyesterday at 9:57 AM

Same in Java and Kotlin, but then again, the majority of people who write code wouldn't understand what I mean when I say "whether a collection is returned as List or Set is an important part of the API 'contract'".