▲ 19 ▼ Efficient C++: The hidden compile-time cost of auto return types (andreasfertig.com) submitted 11 months ago by andreasfertig@programming.dev to c/cpp@programming.dev 13 comments fedilink hide all child comments
[–] LodeMike@lemmy.today 3 points 11 months ago (3 children) Why the fuck do people do this to themselves. permalink fedilink source parent hideshow 6 child comments replies: [+] Lembot_0004@discuss.online 5 points 11 months ago* (last edited 9 months ago) (1 child) [deleted] permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 3 points 11 months ago (1 child) Nuter one of the main reasons for headers: documentation. permalink fedilink source parent hideshow 2 child comments replies: [–] entwine@programming.dev 2 points 11 months ago (1 child) I think you're conflating regular auto use with using it as a return type/argument. The latter is syntactic sugar for declaring a template. It isn't any less "documented" than doing a template<class ReturnType>.... permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 1 point 11 months ago Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway. permalink fedilink source parent [–] DapperPenguin@programming.dev 3 points 11 months ago (1 child) From my discussion with C++ folk, auto is just part of the "modern" way of doing c++. Paired with the -> return type. Perhaps including that -> return type negates this problem? It's still strange to me. Feels more like Rust permalink fedilink source parent hideshow 2 child comments replies: [–] bitcrafter@programming.dev 2 points 11 months ago One day the use of auto will grow so extensive that modern Python code will have more type annotations than modern C++ code! permalink fedilink source parent [–] 6nk06@sh.itjust.works 1 point 10 months ago Clean code, and compile-time is irrelevant for most projects. permalink fedilink source parent
[+] Lembot_0004@discuss.online 5 points 11 months ago* (last edited 9 months ago) (1 child) [deleted] permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 3 points 11 months ago (1 child) Nuter one of the main reasons for headers: documentation. permalink fedilink source parent hideshow 2 child comments replies: [–] entwine@programming.dev 2 points 11 months ago (1 child) I think you're conflating regular auto use with using it as a return type/argument. The latter is syntactic sugar for declaring a template. It isn't any less "documented" than doing a template<class ReturnType>.... permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 1 point 11 months ago Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway. permalink fedilink source parent
[–] LodeMike@lemmy.today 3 points 11 months ago (1 child) Nuter one of the main reasons for headers: documentation. permalink fedilink source parent hideshow 2 child comments replies: [–] entwine@programming.dev 2 points 11 months ago (1 child) I think you're conflating regular auto use with using it as a return type/argument. The latter is syntactic sugar for declaring a template. It isn't any less "documented" than doing a template<class ReturnType>.... permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 1 point 11 months ago Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway. permalink fedilink source parent
[–] entwine@programming.dev 2 points 11 months ago (1 child) I think you're conflating regular auto use with using it as a return type/argument. The latter is syntactic sugar for declaring a template. It isn't any less "documented" than doing a template<class ReturnType>.... permalink fedilink source parent hideshow 2 child comments replies: [–] LodeMike@lemmy.today 1 point 11 months ago Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway. permalink fedilink source parent
[–] LodeMike@lemmy.today 1 point 11 months ago Having the return type name is absolutely better documented. But I guess were splitting hairs because its a hard typed language and lexers can find what it is anyway. permalink fedilink source parent
[–] DapperPenguin@programming.dev 3 points 11 months ago (1 child) From my discussion with C++ folk, auto is just part of the "modern" way of doing c++. Paired with the -> return type. Perhaps including that -> return type negates this problem? It's still strange to me. Feels more like Rust permalink fedilink source parent hideshow 2 child comments replies: [–] bitcrafter@programming.dev 2 points 11 months ago One day the use of auto will grow so extensive that modern Python code will have more type annotations than modern C++ code! permalink fedilink source parent
[–] bitcrafter@programming.dev 2 points 11 months ago One day the use of auto will grow so extensive that modern Python code will have more type annotations than modern C++ code! permalink fedilink source parent
[–] 6nk06@sh.itjust.works 1 point 10 months ago Clean code, and compile-time is irrelevant for most projects. permalink fedilink source parent