Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
b8916aa2
Commit
b8916aa2
authored
8 years ago
by
vjpai
Browse files
Options
Downloads
Patches
Plain Diff
Don't global initialize anything to nullptr
parent
b31a9a09
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/cpp-style-guide.md
+6
-0
6 additions, 0 deletions
doc/cpp-style-guide.md
with
6 additions
and
0 deletions
doc/cpp-style-guide.md
+
6
−
0
View file @
b8916aa2
...
...
@@ -53,6 +53,12 @@ default capture). Other C++ functional features such as
(../include/grpc++/impl/codegen/config.h). Instead, pointers should
be checked for validity using their implicit conversion to
`bool`
.
In other words, use
`if (p)`
rather than
`if (p != nullptr)`
-
Do not initialize global/static pointer variables to
`nullptr`
. Just let
the compiler implicitly initialize them to
`nullptr`
(which it will
definitely do). The reason is that
`nullptr`
is an actual object in
our implementation rather than just a constant pointer value, so
static/global constructors will be called in a potentially
undesirable sequence.
-
Do not use
`final`
or
`override`
as these are not supported by some
compilers. Instead use
`GRPC_FINAL`
and
`GRPC_OVERRIDE`
. These
compile down to the traditional C++ forms for compilers that support
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment