LLVM Coding Standards

Nick Sabalausky a at a.a
Tue Apr 12 04:18:17 PDT 2011


"spir" <denis.spir at gmail.com> wrote in message 
news:mailman.3428.1302601845.4748.digitalmars-d at puremagic.com...
> On 04/11/2011 09:58 PM, spir wrote:
>> I'm reading (just for interest) the LLVM Coding Standards at
>> http://llvm.org/docs/CodingStandards.html. Find them very interesting 
>> because
>> their purposes are clearly explained. Below sample.
>
> I also love their note about naming:
>
> ====================================
> Name Types, Functions, Variables, and Enumerators Properly
>
> Poorly-chosen names can mislead the reader and cause bugs. We cannot 
> stress enough how important it is to use descriptive names. Pick names 
> that match the semantics and role of the underlying entities, within 
> reason. Avoid abbreviations unless they are well known. After picking a 
> good name, make sure to use consistent capitalization for the name, as 
> inconsistency requires clients to either memorize the APIs or to look it 
> up to find the exact spelling.
> ====================================
>

I might have mentioned this before, but there was one company I used to work 
for that regularly had index/counter variables with names like "aaa", "bbb" 
and "ccc", and I even found a data-loading function named "save". That 
confused the crap out of me for a quite a while. I don't think I'll ever 
forget that. There were sooo many other code WTFs there too. Perhaps 
unsurprisingly, it was a VB house.





More information about the Digitalmars-d mailing list