[LLVMdev] Guidance on using pointers vs. references for function arguments

Artyom Skrobov Artyom.Skrobov at arm.com
Wed May 28 07:46:01 PDT 2014


Hello Chris and Chandler,

> This last sentence should read: it's lower mental overhead
> for the programmer to use the same type consistently rather
> than worrying about another convention to follow at every
> call.

But, the whole point of having this in the Standards is that there is only
one convention to follow -- as opposed to, another convention in every part
of the code!

An infrequent contributor myself, I identify strongly with Chandler's
earlier argument that "the simplicity of a consistent rule [is] far more
appealing than "getting a feel for which types" should be passed as
pointers."


> Maybe its just the devs I know who don't really have
> trouble here, but its not one of the complaints I hear
> from others or have myself in day-to-day development.

I understand that for experienced contributors who work extensively on a
part of LLVM, the "local conventions" can seem natural and unobtrusive; but
for a newcomer, "getting a feel" for such ambiguous, implicit conventions is
just a speed-bump in the way of contributing to the project.

It's fair enough to have the balance between the convenience for veterans
and the convenience for novices shifted in favour of the veterans, but I
just want to point out that this trade-off exists.


(FTR, I've browsed through the revision history of CodingStandards.rst and
its predecessor CodingStandards.html, and I couldn't find any traces of the
previous incarnation of pointers-vs-references guidance.)







More information about the llvm-dev mailing list