[LLVMdev] LLD vs LLVM coding style...

Dimitri Tcaciuc dtcaciuc at gmail.com
Tue Jan 22 21:42:22 PST 2013


Oh jeez, typical ... Accidentally sent this only to Krzysztof instead of
everyone; my apologies for duplicate.

----

If I may pitch in, yes, very true, but I would personally categorize this
as a nomenclature problem, in which case is quite important to have same
naming convention for things. Examples of literature that strive to be
similarly unambiguous are things like references and user manuals; if
chapter 1 is in English and chapter 2 is in German, it wouldn't be very
nice. Additionally, same word in two languages frequently means a vastly
different thing :)

In that light, I'd say things like naming conventions (M for module,
V1...V2 for vars, etc) and whether to use CamelCase or not are really quite
important. Some automatic assumptions that you end up acquiring, such as
wether something is a variable, class or something else break completely
otherwise (*especially* if you work on two projects at once). Another thing
I rate quite highly is tabs/spaces/number of spaces convention. While you
can configure your editor to have different settings based on file type, it
becomes a nuisance when dealing with only one type (ie. C++). The problem
is especially aggravated in case if, for, etc. blocks don't necessarily
have {} around them (and I've seen that in LLVM/Clang at least a few
times). On the other hand, things like whether lines occasionally go over
80 character limits (and I dont mean like 120 chars) or if initializer
lists have leading commas, well, among other issues that's likely not
lethal. As opposed to capitalizing variables or not, there is no ambiguity
incurred.

Finally, I'd imagine status quo coding standard will eventually grow on
folks who have hard time switching instantly. In the process, some aspects
might also migrate the other way into LLVM core, which may very well be a
good thing.

Cheers,


Dimitri.


On Tue, Jan 22, 2013 at 2:35 PM, Krzysztof Parzyszek <
kparzysz at codeaurora.org> wrote:

> On 1/22/2013 4:15 PM, Chandler Carruth wrote:
>
>>
>> A different naming convention is one of the most disruptive things to
>> have change between two code bases. It will cause people to habitually
>> write code one way, realize they are submitting to the other repository,
>> and have to mechanically go and rename all their variables. While I
>> personally like your naming convention slightly better than LLVM's, and
>> a few other conventions slightly better than yours, I really don't care.
>>
>
> FWIW, I think this is like switching between spoken languages.  At the
> beginning you can get things mixed up, but once you gain proficiency, you
> can use either without difficulty.
>
> -Krzysztof
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by The Linux Foundation
>
> ______________________________**_________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130122/65235cb5/attachment.html>


More information about the llvm-dev mailing list