C++ trivia
-
Just to be on the safe side, be sure to consider this is the most distinct use of the colon.[^]
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
I was going to say, "to write VB code because only ... " but he beat me too it ... :-D
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
i forgot labels. So now that's two things i forgot
Real programmers use butterflies
global scope operator, as in ::foo
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
-
global scope operator, as in ::foo
#SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)
Real programmers use butterflies
-
I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)
Real programmers use butterflies
In a ternary oparator
sResult=(x<=0)?"0 or negative":"positive";
-
List the distinct uses for a colon in C++. Motivated by currently writing a function that had better take all of them into account! :-D
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.To keep my gastroenterologist in BMW's? Oh wait, wrong colon; my bad.
Software Zen:
delete this;
-
static member access, constructor initialization list. Base class list, namespace access, ternary operator,
case
signifier terminator. I feel like there are more but I'm sleepy. edit: other commenters pointed out labels and bitfields Don't forget to escape strings and chars!Real programmers use butterflies
Range-based for loop?
-
In a ternary oparator
sResult=(x<=0)?"0 or negative":"positive";
i already mentioned that.
Real programmers use butterflies
-
Range-based for loop?
is that a C++20 thing?
Real programmers use butterflies
-
is that a C++20 thing?
Real programmers use butterflies
Nah, looks like C++11. e.g. for (auto it : vector) Range-based for loop (since C++11) - cppreference.com[^]
-
Nah, looks like C++11. e.g. for (auto it : vector) Range-based for loop (since C++11) - cppreference.com[^]
huh. I've never actually used that..
Real programmers use butterflies
-
static member access, constructor initialization list. Base class list, namespace access, ternary operator,
case
signifier terminator. I feel like there are more but I'm sleepy. edit: other commenters pointed out labels and bitfields Don't forget to escape strings and chars!Real programmers use butterflies
-
i did, because of the way the original question was worded.
Real programmers use butterflies
-
List the distinct uses for a colon in C++. Motivated by currently writing a function that had better take all of them into account! :-D
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.Hi. I would like to help with the answer to your question. First, one colon is used to indicate the base class when inheriting from classes. Second, a single colon is used to specify the initialization list for the constructor. The two colons are the scoping operator.
Used to access the elements of the namespace. But in this matter, the editors of this site are more competent. Read more here: [url=https://sirinsoftware.com/services/iot-development/\]https://sirinsoftware.com/services/iot-development/\[/url\]