C++ trivia
-
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\]