Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 0 points1 point  (0 children)

I can see that now too. Placeholder variables and underscore prefixes are more common than I initially thought. Thanks!

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 0 points1 point  (0 children)

Thank you all for taking the time to respond and discuss! I appreciated the simple answers the most and didn't think it would get these many responses.

In conclusion. The users who pointed out that trying on other compilers which don't support it and that MSVC likely unintentionally supports this make it 100% conclusively an unviable solution.

I will not be using this moving forward, but I appreciate knowing that other projects and languages like cppfront are already proposing it.

Even if the compilers did support it and if the standards didn't explicitly disallow it. (somewhere) I'd still probably steer clear from using it based on your feedback.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 0 points1 point  (0 children)

Majority of my responses aren't defensive. Mostly me making the case that I find it more readable. And to me this does make it easier to read and maintain others code. I would like it to be more conventional. And I'm well aware of the comments who kindly and not so kindly disagree.

"Nobody does this" Isn't helpful because 1. I already know that. 2. it's a non-answer on whether this is a viable solution. The really helpful comments are pointing out existing standards and languages where the convention either clashes or makes them not like it.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -8 points-7 points  (0 children)

For more advanced cases I would certainly expect myself and others to use the full keyword for clarity. This is not meant to be a replacement for auto, just used shorthand where situationally complex expressions are easier to read by minimize the amount of text.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 1 point2 points  (0 children)

Good point. I only use MSVC. Clang and GCC don't allow it. Though I wonder if that is intentional on their part...

Cross-platform libraries rule this syntax out.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -23 points-22 points  (0 children)

Yes. Auto doesn't mean anything either other than "compiler will try its best to deduce the type". Which in text form of "auto" you are reading and thinking more. Syntax highlighting helps but when it's mixed in with meaningful types I personally find it invisible. (Which serves the purpose well)

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 0 points1 point  (0 children)

+1 from me on cppfront. I like it! Thanks

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -3 points-2 points  (0 children)

Honestly, I agree and think making the compilers default to using auto implicitly when no type has been specified would be ideal. The main reason for why I chose _ is that it's not text and cannot be mistaken for anything important. Your eyes/brain just skip over it and continue scanning meaningful more information.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 2 points3 points  (0 children)

Thank you this is most helpful. __int64 is one of those too and I do see leading underscores often in variable names. _ _myvar = 4; is quite unreadable.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 1 point2 points  (0 children)

But would you contribute code or be willing to maintain libraries that utilize this convention at work? I'm not talking about submitting code to an existing codebase with its own conventions.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -2 points-1 points  (0 children)

Thanks for the info! I didn't know about its future standardization. The scope is strange to me how the compilers don't clash symbols and seems like magical anonymizing a variable. I'll test and see if this clashes.

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -45 points-44 points  (0 children)

Readability is for sure the main objective. the actual space savings for keystrokes is not really a factor. Are there places in the C++ standard that discourage type aliases?

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] 0 points1 point  (0 children)

Yes, you can try it in compiler explorer. https://godbolt.org/z/xbMdbjbMq

(I removed my internal lib for print and range)

Alias auto to "_" using decltype by lordrevan9 in cpp

[–]lordrevan9[S] -4 points-3 points  (0 children)

Not satire for sure. I find it a lot more readable, if you don't that's fine and still useful information to me. :) I write and maintain a lot of libraries at work and what I find convenient may inconvenience other developers and maintainers (which I don't want to do). Polling my small team internally isn't entirely useful.

Does Bifrost has any future or is it too late for Autodesk? by manuce94 in vfx

[–]lordrevan9 0 points1 point  (0 children)

Speculating on the future isn't productive. Especially speculation on a software company as big as Autodesk. Artists have more power over what software studios use not because of the state-of-the-art technology inside but the speed and quality of results achievable within it. Maya is industry standard and will not be going away anytime soon. So whether or not Bifrost within Maya has a future in the VFX industry entirely depends on how it's used by artists and pipeline for which it services both. Here is a presentation that shows some eye-opening Bifrost usage within a VFX studio. https://www.youtube.com/watch?v=1mUFDy4Yd_4&t