Comments (5)
Using the C++ Core Guidelines as a base and building on it is a good idea. Most of the Core Guidelines are uncontroversial and really good even if they are somewhat geared towards higher level code (pointer arithmetic is frowned upon for instance which is needed for low-level code).
But this disucssion has gone a "little" beyond what this issue was originally about and probably needs to be discussed somewhere else.
from vtquery.
There is a huge controversy in the C++ community on this at the moment. This is now called "east const" vs. "const west". At the last big C++ conference (C++Now 2018) supporters of both sides gave out colored armbands to show support for on side or the other. Here is one blog post about this: http://slashslash.info/2018/02/a-foolish-consistency/
Anyway, consistency is good, so either one or the other.
from vtquery.
Looks like "const west" people won: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl26-use-conventional-const-notation. But at least the "east const" people knew exactly which arm to wear the armband on.
(the right arm of course)
from vtquery.
@alliecrevier No, those core guidelines were written before this discussion blew up in the last few months and they are not the result of some kind of community consensus. The guidelines were critized in the discussion for using the wrong arguments. So this is still ongoing.
from vtquery.
@joto What do you think about using the C++ Core Guidelines except when we have reason to disagree?
As a way of making it easier to share and contribute to code in a consistent way, we can point people to the C++ Core Guidelines but tell them to check the Mapbox C++ Core-tech Guidelines for exceptions. Each project could even have their own set of guideline exceptions.
This could be a convenient way to organize our style guide. For instance, if we want to document that we use "east const" it could look something like:
NL.26-modified: Use east const notation
Reason
Even though conventional notation, aka const west notation, is more familiar to more programmers, we believe east const improves the readability of our code because it's simpler. The rule is that const should always be on the right of what it modifies.
Example
int const y = 9; // recommended, const int
const int x = 7; // not recommended, const int
int const * p = nullptr; // recommended, pointer to const int
const int * p = nullptr; // not recommended, pointer to const int
int * const p = nullptr; // recommended (for both notations), const pointer to int
int const * const p = nullptr; // recommended, const pointer to const int
const int * const p = nullptr; // not recommended, const pointer to const int
Note
The recommended examples follow a simple rule so is easier to read and teach.
from vtquery.
Related Issues (20)
- Protecting against trouble on invalid limit values HOT 9
- Update to vtzero 1.x
- build binaries for node v8.x HOT 1
- reduce package size by removing mason deps
- vtzero::convert_property_value inside worker HOT 3
- Why zxy values extracted as int64_t and then casted to uint32_t ? HOT 2
- Node v10 support
- v0.3.0 release
- Tests for internal decompression support
- when to use std::int32_t and std::int64_t HOT 2
- Failing to compile with g++-6 HOT 1
- More efficient response format HOT 1
- node v10 deprecations breaking travis HOT 1
- LeakSanitizer: detected memory leaks HOT 1
- [Feature] Basic Filtering Options HOT 6
- sanitizer ASAN build failures HOT 4
- N-API Port & add support to node 14 & 16
- Add support to node 14 & 16 HOT 1
- Remove mason-js dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vtquery.