Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C++ trivia

C++ trivia

Scheduled Pinned Locked Moved The Lounge
c++asp-netcomtoolsquestion
25 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Greg UtasG Greg Utas

    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.

    W Offline
    W Offline
    W Balboos GHB
    wrote on last edited by
    #2

    Just to be on the safe side, be sure to consider this is the most distinct use of the colon.[^]

    Ravings en masse^

    "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

    Greg UtasG OriginalGriffO 2 Replies Last reply
    0
    • Greg UtasG Greg Utas

      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.

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #3

      Isn't it just another separator? :-D

      1 Reply Last reply
      0
      • Greg UtasG Greg Utas

        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.

        D Offline
        D Offline
        den2k88
        wrote on last edited by
        #4

        It's the brits fault, they colonized even C++.

        GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X

        1 Reply Last reply
        0
        • Greg UtasG Greg Utas

          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.

          D Offline
          D Offline
          DRHuff
          wrote on last edited by
          #5

          A colon is the hat that most Q&A questioners wear. :-D

          If you can't laugh at yourself - ask me and I will do it for you.

          1 Reply Last reply
          0
          • Greg UtasG Greg Utas

            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.

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #6

            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

            C D J S 4 Replies Last reply
            0
            • H honey the codewitch

              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

              C Offline
              C Offline
              Chris Losinger
              wrote on last edited by
              #7

              also bitfield definitions

              H 1 Reply Last reply
              0
              • H honey the codewitch

                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

                D Offline
                D Offline
                DRHuff
                wrote on last edited by
                #8

                goto the head of the class!

                If you can't laugh at yourself - ask me and I will do it for you.

                H 1 Reply Last reply
                0
                • C Chris Losinger

                  also bitfield definitions

                  H Offline
                  H Offline
                  honey the codewitch
                  wrote on last edited by
                  #9

                  Thanks. I knew i was forgetting something!

                  Real programmers use butterflies

                  1 Reply Last reply
                  0
                  • D DRHuff

                    goto the head of the class!

                    If you can't laugh at yourself - ask me and I will do it for you.

                    H Offline
                    H Offline
                    honey the codewitch
                    wrote on last edited by
                    #10

                    i forgot labels. So now that's two things i forgot

                    Real programmers use butterflies

                    T 1 Reply Last reply
                    0
                    • W W Balboos GHB

                      Just to be on the safe side, be sure to consider this is the most distinct use of the colon.[^]

                      Ravings en masse^

                      "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

                      Greg UtasG Offline
                      Greg UtasG Offline
                      Greg Utas
                      wrote on last edited by
                      #11

                      Now why would I be hesitating to click on that link? :-D EDIT: Curiosity killed the cat. But it could have been worse!

                      Robust Services Core | Software Techniques for Lemmings | Articles
                      The fox knows many things, but the hedgehog knows one big thing.

                      <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                      <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                      W 1 Reply Last reply
                      0
                      • Greg UtasG Greg Utas

                        Now why would I be hesitating to click on that link? :-D EDIT: Curiosity killed the cat. But it could have been worse!

                        Robust Services Core | Software Techniques for Lemmings | Articles
                        The fox knows many things, but the hedgehog knows one big thing.

                        W Offline
                        W Offline
                        W Balboos GHB
                        wrote on last edited by
                        #12

                        Greg Utas wrote:

                        Now why would I be hesitating to click on that link?

                        Answer I'd have given: Hesitant? Perhaps not enough roughage?

                        Ravings en masse^

                        "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

                        1 Reply Last reply
                        0
                        • W W Balboos GHB

                          Just to be on the safe side, be sure to consider this is the most distinct use of the colon.[^]

                          Ravings en masse^

                          "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

                          OriginalGriffO Offline
                          OriginalGriffO Offline
                          OriginalGriff
                          wrote on last edited by
                          #13

                          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 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

                          1 Reply Last reply
                          0
                          • H honey the codewitch

                            i forgot labels. So now that's two things i forgot

                            Real programmers use butterflies

                            T Offline
                            T Offline
                            TheGreatAndPowerfulOz
                            wrote on last edited by
                            #14

                            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

                            H 1 Reply Last reply
                            0
                            • T TheGreatAndPowerfulOz

                              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

                              H Offline
                              H Offline
                              honey the codewitch
                              wrote on last edited by
                              #15

                              I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)

                              Real programmers use butterflies

                              H 1 Reply Last reply
                              0
                              • H honey the codewitch

                                I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)

                                Real programmers use butterflies

                                H Offline
                                H Offline
                                Helena Munzarova
                                wrote on last edited by
                                #16

                                In a ternary oparator

                                sResult=(x<=0)?"0 or negative":"positive";

                                H 1 Reply Last reply
                                0
                                • Greg UtasG Greg Utas

                                  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.

                                  G Offline
                                  G Offline
                                  Gary Wheeler
                                  wrote on last edited by
                                  #17

                                  To keep my gastroenterologist in BMW's? Oh wait, wrong colon; my bad.

                                  Software Zen: delete this;

                                  1 Reply Last reply
                                  0
                                  • H honey the codewitch

                                    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

                                    J Offline
                                    J Offline
                                    jason_s_coleman
                                    wrote on last edited by
                                    #18

                                    Range-based for loop?

                                    H 1 Reply Last reply
                                    0
                                    • H Helena Munzarova

                                      In a ternary oparator

                                      sResult=(x<=0)?"0 or negative":"positive";

                                      H Offline
                                      H Offline
                                      honey the codewitch
                                      wrote on last edited by
                                      #19

                                      i already mentioned that.

                                      Real programmers use butterflies

                                      1 Reply Last reply
                                      0
                                      • J jason_s_coleman

                                        Range-based for loop?

                                        H Offline
                                        H Offline
                                        honey the codewitch
                                        wrote on last edited by
                                        #20

                                        is that a C++20 thing?

                                        Real programmers use butterflies

                                        J 1 Reply Last reply
                                        0
                                        • H honey the codewitch

                                          is that a C++20 thing?

                                          Real programmers use butterflies

                                          J Offline
                                          J Offline
                                          jason_s_coleman
                                          wrote on last edited by
                                          #21

                                          Nah, looks like C++11. e.g. for (auto it : vector) Range-based for loop (since C++11) - cppreference.com[^]

                                          H 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups