Operators in C++ what does (::Type*)0 meanWhat is the meaning of prepended double colon “::”?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What are POD types in C++?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?What is move semantics?What is The Rule of Three?What are the basic rules and idioms for operator overloading?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?
Make 24 using exactly three 3s
What could a self-sustaining lunar colony slowly lose that would ultimately prove fatal?
Shorten or merge multiple lines of `&> /dev/null &`
My players want to grind XP but we're using landmark advancement
Do photons bend spacetime or not?
Should there be an "a" before "ten years imprisonment"?
Manager questioning my time estimates for a project
Gravitational Force Between Numbers
Is it rude to call a professor by their last name with no prefix in a non-academic setting?
Is there any relationship between frequency of signal and distance it travels?
Best material to absorb as much light as possible
Why did Jon Snow do this immoral act if he is so honorable?
Which European Languages are not Indo-European?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
Does French have the English "short i" vowel?
USPS Back Room - Trespassing?
Why haven't we yet tried accelerating a space station with people inside to a near light speed?
What was the idiom for something that we take without a doubt?
Why is unzipped directory exactly 4.0k (much smaller than zipped file)?
Where is Jon going?
Is it legal to have an abortion in another state or abroad?
Is the Unsullied name meant to be ironic? How did it come to be?
What's difference between "depends on" and "is blocked by" relations between issues in Jira next-gen board?
Why did British Steel have to borrow 120 million pounds (from the government) to cover its ETS obligations?
Operators in C++ what does (::Type*)0 mean
What is the meaning of prepended double colon “::”?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What are POD types in C++?The Definitive C++ Book Guide and ListWhat is the effect of extern “C” in C++?What is the “-->” operator in C++?What is move semantics?What is The Rule of Three?What are the basic rules and idioms for operator overloading?C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Can anyone tell me what this means?
(::Type*)0
actually it is part of this
return (is_modifytype()) ?
u.myfunction : (::Type*)0;
c++
add a comment |
Can anyone tell me what this means?
(::Type*)0
actually it is part of this
return (is_modifytype()) ?
u.myfunction : (::Type*)0;
c++
21
It means that this is old code that should be rewritten to usenullptr
.
– Sam Varshavchik
9 hours ago
add a comment |
Can anyone tell me what this means?
(::Type*)0
actually it is part of this
return (is_modifytype()) ?
u.myfunction : (::Type*)0;
c++
Can anyone tell me what this means?
(::Type*)0
actually it is part of this
return (is_modifytype()) ?
u.myfunction : (::Type*)0;
c++
c++
edited 6 hours ago
Billal Ouali
asked 9 hours ago
Billal OualiBillal Ouali
403
403
21
It means that this is old code that should be rewritten to usenullptr
.
– Sam Varshavchik
9 hours ago
add a comment |
21
It means that this is old code that should be rewritten to usenullptr
.
– Sam Varshavchik
9 hours ago
21
21
It means that this is old code that should be rewritten to use
nullptr
.– Sam Varshavchik
9 hours ago
It means that this is old code that should be rewritten to use
nullptr
.– Sam Varshavchik
9 hours ago
add a comment |
1 Answer
1
active
oldest
votes
It means "cast the integer 0
(using a C-style cast) to the type Trip*
(Trip
pointer) found in the global namespace (::
)".
It should just use nullptr
- as in
return is_modifyCurrentTrip() ?
u.modifyCurrentTrip : nullptr;
Note: using ::
explicitly to designate the global namespace prevents the compiler from prepending any namespace names itself - this is completely irrelevant when just using nullptr
though.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56259783%2foperators-in-c-what-does-type0-mean%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It means "cast the integer 0
(using a C-style cast) to the type Trip*
(Trip
pointer) found in the global namespace (::
)".
It should just use nullptr
- as in
return is_modifyCurrentTrip() ?
u.modifyCurrentTrip : nullptr;
Note: using ::
explicitly to designate the global namespace prevents the compiler from prepending any namespace names itself - this is completely irrelevant when just using nullptr
though.
add a comment |
It means "cast the integer 0
(using a C-style cast) to the type Trip*
(Trip
pointer) found in the global namespace (::
)".
It should just use nullptr
- as in
return is_modifyCurrentTrip() ?
u.modifyCurrentTrip : nullptr;
Note: using ::
explicitly to designate the global namespace prevents the compiler from prepending any namespace names itself - this is completely irrelevant when just using nullptr
though.
add a comment |
It means "cast the integer 0
(using a C-style cast) to the type Trip*
(Trip
pointer) found in the global namespace (::
)".
It should just use nullptr
- as in
return is_modifyCurrentTrip() ?
u.modifyCurrentTrip : nullptr;
Note: using ::
explicitly to designate the global namespace prevents the compiler from prepending any namespace names itself - this is completely irrelevant when just using nullptr
though.
It means "cast the integer 0
(using a C-style cast) to the type Trip*
(Trip
pointer) found in the global namespace (::
)".
It should just use nullptr
- as in
return is_modifyCurrentTrip() ?
u.modifyCurrentTrip : nullptr;
Note: using ::
explicitly to designate the global namespace prevents the compiler from prepending any namespace names itself - this is completely irrelevant when just using nullptr
though.
edited 8 hours ago
answered 9 hours ago
Jesper JuhlJesper Juhl
18.8k32751
18.8k32751
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56259783%2foperators-in-c-what-does-type0-mean%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
21
It means that this is old code that should be rewritten to use
nullptr
.– Sam Varshavchik
9 hours ago