Moved to https://m-pixel.com/prefer-auto-over-auto-for-pointer-declarations-in-c/
For further actions, you may consider blocking this person and/or reporting abuse
For further actions, you may consider blocking this person and/or reporting abuse
MD ARIFUL HAQUE -
Nozibul Islam -
Arsalan Mlaik -
Soma -
Top comments (5)
Hello
auto
never deduces a reference type. Hence,Related
can either be aFConnection
or apointer to FConnection
, nothing else.I must admit that this sample tricked me... But it may sound quite logical when you decompose the statement :
auto VarC = new Type{};
=>VarC
is obviously of pointer.const
=> you have a constant pointer.The reasoning is not symmetrical with explicit type, I grant you that...
I think you're right. Hiding pointers behind typedefs is often considered bad practice in C. We may consider that hiding pointers behind
auto
also as a bad practice too. I will pay attention to in the next months, and I will see ifauto*
improve readability in my code.One might argue that you have should avoided raw pointers in the first place, but as an embedded system developer, I know that pointers always find there way out ;)
Oops! Good catch regarding the reference type. I'll have to fix that in the article.
Thanks for adding the point about that best-practice in C. You're right, it's effectively the same concern. I've always found pointer typedefs to be inconvenient. Certain UE4 subsystems use them a lot.
vt.tiktok.com/ZSjcnX4x7/
Bhai please calling
mrmxshoil999