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. Language + ? = BFF

Language + ? = BFF

Scheduled Pinned Locked Moved The Lounge
csharpc++javagraphicstutorial
44 Posts 13 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.
  • G Gary R Wheeler

    My favorite .NET data structure is Dictionary<_T_> hands down. I always found the C++ equivalents (STL's map and MFC's CMap) somewhat klunkier, mostly because of the template usage and resultant inscrutable compiler diagnostics.

    Software Zen: delete this;

    S Offline
    S Offline
    Single Step Debugger
    wrote on last edited by
    #15

    Yes, Dictionary is verry powerful when you search by key as it gives you O (log N) search, no duplications, ets. But if we go this path then DataTable is even more interesting. I also don't like how you can shoot yourself in the leg with the STL map. One assignment with missing reference operator and you are working with old data/copy.

    There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

    0 1 Reply Last reply
    0
    • S Single Step Debugger

      I wouldn't associate C++ with "virtual". Sure, it's a big part of the language concept, but not defines it. "Virtual" better fits with Java where everything is "virtual" by default. As for the templates, even C++ doesn't fully understand templates - at least until runtime. :) If you don't understand what I mean, think of separate template implementation and declaration. I know it's doable, but it doesn't feel natural.

      There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

      D Offline
      D Offline
      David ONeil
      wrote on last edited by
      #16

      So the word you are looking for is class. Not vector. :doh:

      Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

      S 1 Reply Last reply
      0
      • P PIEBALDconsult

        No generics in v1. System.String is dreadful, the unavoidability of immutability is a very short-sighted (ivory tower) idea. They had to include StringBuilder just to make things work. It would be better for strings to be mutable by default and then be able to set them as immutable later as needed -- mystring.AsReadOnly() or mystring.ReadOnly = true Bleah, ptui. :mad:

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

        And no vector in C++ V1 either ... languages improve! :laugh: But string isn't too bad - it's not perfect, but it is way, way better than the char* / const char * mess that preceded it.

        "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

        P 1 Reply Last reply
        0
        • D David ONeil

          So the word you are looking for is class. Not vector. :doh:

          Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

          S Offline
          S Offline
          Single Step Debugger
          wrote on last edited by
          #18

          Again, not verry C++ specific. Same for structures.

          There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

          D 1 Reply Last reply
          0
          • S Single Step Debugger

            Again, not verry C++ specific. Same for structures.

            There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

            D Offline
            D Offline
            David ONeil
            wrote on last edited by
            #19

            Quote:

            What single structure or specific operator better defines a given language?

            That was your question. template, virtual, and class are all better answers than vector. In fact, vector is an idiotic answer to that specific question. Especially since vector isn't a structure or operator. :doh: :doh: :doh: Of course, neither are the items I've given, but they do define the language.

            Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

            S 1 Reply Last reply
            0
            • S Single Step Debugger

              What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?

              There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

              M Offline
              M Offline
              megaadam
              wrote on last edited by
              #20

              I would've said Java class Object But on the other hand I must admit that, when it comes to Java for me personally, a ten-foot-pole aint long enough :cool:

              "If we don't change direction, we'll end up where we're going"

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                And no vector in C++ V1 either ... languages improve! :laugh: But string isn't too bad - it's not perfect, but it is way, way better than the char* / const char * mess that preceded it.

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

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

                OriginalGriff wrote:

                languages improve

                Then it's not the same language.

                1 Reply Last reply
                0
                • S Single Step Debugger

                  Yes, Dictionary is verry powerful when you search by key as it gives you O (log N) search, no duplications, ets. But if we go this path then DataTable is even more interesting. I also don't like how you can shoot yourself in the leg with the STL map. One assignment with missing reference operator and you are working with old data/copy.

                  There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                  0 Offline
                  0 Offline
                  0x01AA
                  wrote on last edited by
                  #22

                  STL map is pretty ok, but you need to know how to use it....

                  S 1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    Python: a tab and three spaces just to annoy people.

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

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

                    How big is the tab? Like a bar tab?

                    1 Reply Last reply
                    0
                    • G Gary R Wheeler

                      My favorite .NET data structure is Dictionary<_T_> hands down. I always found the C++ equivalents (STL's map and MFC's CMap) somewhat klunkier, mostly because of the template usage and resultant inscrutable compiler diagnostics.

                      Software Zen: delete this;

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

                      enums are also way better in .net languages.

                      0 1 Reply Last reply
                      0
                      • S Single Step Debugger

                        What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?

                        There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                        A Offline
                        A Offline
                        Amarnath S
                        wrote on last edited by
                        #25

                        Javascript - "undefined". :-)

                        P 1 Reply Last reply
                        0
                        • S Single Step Debugger

                          What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?

                          There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

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

                          C++ for me would be template I don't really use the STL that much due to working with tiny amounts of RAM.

                          To err is human. Fortune favors the monsters.

                          S 1 Reply Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            Python: a tab and three spaces just to annoy people.

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

                            V Offline
                            V Offline
                            Vikram A Punathambekar
                            wrote on last edited by
                            #27

                            Python 3 doesn't allow mixing tabs and spaces though :) But I really wish they had gone with tabs as the preferred option rather than spaces X|

                            Cheers, Vikram.

                            P 1 Reply Last reply
                            0
                            • S Single Step Debugger

                              What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?

                              There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                              K Offline
                              K Offline
                              kmoorevs
                              wrote on last edited by
                              #28

                              Basic = Dim! :laugh:

                              "Go forth into the source" - Neal Morse "Hope is contagious"

                              1 Reply Last reply
                              0
                              • V Vikram A Punathambekar

                                Python 3 doesn't allow mixing tabs and spaces though :) But I really wish they had gone with tabs as the preferred option rather than spaces X|

                                Cheers, Vikram.

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

                                Maybe there should be an option, perhaps something like strict.

                                1 Reply Last reply
                                0
                                • A Amarnath S

                                  Javascript - "undefined". :-)

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

                                  Visual Basic -- nothing Mmm, yeah, quite literally.

                                  1 Reply Last reply
                                  0
                                  • P PIEBALDconsult

                                    enums are also way better in .net languages.

                                    0 Offline
                                    0 Offline
                                    0x01AA
                                    wrote on last edited by
                                    #31

                                    Sorry, the only language I know, which treats enum as enum is Modula2. All languages who allow to assign an enum item a individual value don't treat enum as enum and it should be forbidden that these languages missuse the a type called enum. ;)

                                    P 1 Reply Last reply
                                    0
                                    • 0 0x01AA

                                      Sorry, the only language I know, which treats enum as enum is Modula2. All languages who allow to assign an enum item a individual value don't treat enum as enum and it should be forbidden that these languages missuse the a type called enum. ;)

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

                                      Unsure what you are saying. Do you mean the ability to assign a value which isn't defined by the enum? I can agree with not liking that.

                                      0 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Unsure what you are saying. Do you mean the ability to assign a value which isn't defined by the enum? I can agree with not liking that.

                                        0 Offline
                                        0 Offline
                                        0x01AA
                                        wrote on last edited by
                                        #33

                                        My view, only: enumeration should be only enumeration. Means nobody should have the right to assign a specific value to any member of an enum. enum {theFirst, theSecond} should always end theFirst= 0, theSecond= 1. Even they should not be addressed by an intgeger value. Like it is in e.g. Modula2. And no one should be allowed to define theFirst= 1000 Sorry, I'm not native english and therefore I have problems to express me. [Edit] An enumeration where you can define element0= -100 or whatever and element1= 100 is not an enumeration for me ;)

                                        P 1 Reply Last reply
                                        0
                                        • 0 0x01AA

                                          My view, only: enumeration should be only enumeration. Means nobody should have the right to assign a specific value to any member of an enum. enum {theFirst, theSecond} should always end theFirst= 0, theSecond= 1. Even they should not be addressed by an intgeger value. Like it is in e.g. Modula2. And no one should be allowed to define theFirst= 1000 Sorry, I'm not native english and therefore I have problems to express me. [Edit] An enumeration where you can define element0= -100 or whatever and element1= 100 is not an enumeration for me ;)

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

                                          Ah, I see, but I disagree. I prefer to be able to specify the values. It's kinda important for "flags" type enumerated values. Maybe there should be an Attribute which enables things -- yes, I know about the FlagsAttribute, but it really only affects how strings are formed or parsed, it has nothing to do with what values are defined or assigned.

                                          public enum Option
                                          {
                                          None = 0
                                          ,
                                          UTF8 = 1
                                          ,
                                          ASCII = 2 | UTF8
                                          ,
                                          All = ASCII
                                          }

                                          Maybe a "bare" enum would enforce a strict value assignment and the ability to specify the values would require the developer to activate other features.

                                          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