User Tools

Site Tools


coding_guidelines

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
coding_guidelines [2019/09/27 18:18]
daschuer [override / final]
coding_guidelines [2020/02/05 16:46]
tapir [Line Widths] Broken lines indent
Line 86: Line 86:
 ===== Line Widths ===== ===== Line Widths =====
  
-Please configure your editor to have a max column-width of 80-columns. While it is not a strict requirement,​ 80-column cleanliness makes it easy to tile multiple buffers of code across a laptop screen, which provides significant efficiency gains to developers. Use double indent (8-spaces) for broken lines or align with the opening "​("​ in the line above for hanging indents.+Please configure your editor to have a max column-width of 80-columns. While it is not a strict requirement,​ 80-column cleanliness makes it easy to tile multiple buffers of code across a laptop screen, which provides significant efficiency gains to developers. 
 + 
 +For Mixxx'​s clang-format compatibility (ColumnLimit:​ 0):  
 +  * Use double indent (8-spaces) for broken lines 
 +  * Break line after binary operators.  
 +  * If you break a list of function parameters, put each parameter on a single ​line.  
  
  
Line 510: Line 515:
 </​code>​ </​code>​
  
-               +===== QString ===== 
 + 
 +Use [[http://​doc.qt.io/​qt-5/​qstring.html#​QStringLiteral|QStringLiteral]]. This has a variety of [[https://​woboq.com/​blog/​qstringliteral.html|benefits]].  
 + 
 +Escape non ASCII characters:  
 + 
 +<code cpp-qt>​ 
 +QStringLiteral("​Hello I\u2019ve to go"​);​ 
 +</​code>​ 
 + 
 +QChars can be initialized with ASCII characters 16 bit Unicode L’\u00fc'​ if required. Both are constexpr.  
 + 
 +<code cpp-qt>​ 
 +constexpr QChar kc = '​c'​ 
 +constexpr QChar kue = L'​\u00fc'​ // for "​ü"​ 
 +</​code>​ 
 + 
 +From Mixxx 2.3 we set QT_USE_QSTRINGBUILDER to use QStringBuilder for operator+. Use + in favour of % for better readability. ​         ​
  
  
Line 522: Line 544:
  
  
-===== C++14 =====+===== C++17 =====
  
-As of the Mixxx 2.3 release, Mixxx is switching to C++14. We are taking a conservative approach to adopting C++11/14 features and whitelisting them one by one. If a C++11/14 feature you would like to use is not listed here, please email mixxx-devel to make a case for it and we will consider whitelisting it.+As of the Mixxx 2.3 release, Mixxx is switching to C++17. We are taking a conservative approach to adopting C++11/14/17 features and whitelisting them one by one. If a C++11/14/17 feature you would like to use is not listed here, please email mixxx-devel to make a case for it and we will consider whitelisting it.
  
 We are limited to what is supported across our 3 supported compilers: We are limited to what is supported across our 3 supported compilers:
Line 581: Line 603:
 Use. Use.
  
-==== unicode string literals ==== 
  
-**Do Not Use**. Once we switch to Qt5, you should use [[http://​doc.qt.io/​qt-5/​qstring.html#​QStringLiteral|QStringLiteral]]. This has a variety of [[https://​woboq.com/​blog/​qstringliteral.html|benefits]]. ​ 
  
 ==== right angle brackets ==== ==== right angle brackets ====
coding_guidelines.txt · Last modified: 2020/05/22 06:30 by xerus