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. Other Discussions
  3. The Back Room
  4. I have noticed that there is ...

I have noticed that there is ...

Scheduled Pinned Locked Moved The Back Room
discussioncsharpc++comdesign
74 Posts 20 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.
  • Z Zdeslav Vojkovic

    jan larsen wrote: I don't make any more type casts in C# that I do in C++ this is the most annoying aspect of working with collections in C# (i'm talking about 1.0 version which doesn't support generics, of course). you have to cast everything from object to your target type, or you must provide a different specialized collection for every type (and still you must support Add(object o) in interface, so there is no type safety in it). there is also no support for returning covariant types in interfaces: C++ also doesn't support it, but you can at least workaround this to some extent using templates. also, i find the handling of value types in containers horrible, with all the boxing/unboxing. ever tried to foreach over a collection of value type instances, and change something? you can't, you must change the the whole object, because you only get the copy. also, foreach is so much slower than simple for loop, that i don't even use it. OTOH, what i like in C# is intrinsic support for properties and events, but this is something you can have in C++ too, with some quite simple coding. and one more thing: the complete abomination of "using" statement to handle object lifetime. so they added a keyword (which already head 2 different meanings) to the language to support the IDisposable interface, which is just a convention on the framework level?

    C Offline
    C Offline
    Colin Angus Mackay
    wrote on last edited by
    #32

    Zdeslav Vojkovic wrote: ever tried to foreach over a collection of value type instances, and change something? you can't, you must change the the whole object That sounds correct. A value type is immutable. IIRC that appies to value types in any OO language (if that condition does not apply then it is not a value type in the OO sense)


    My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

    Z 1 Reply Last reply
    0
    • C Colin Angus Mackay

      Zdeslav Vojkovic wrote: ever tried to foreach over a collection of value type instances, and change something? you can't, you must change the the whole object That sounds correct. A value type is immutable. IIRC that appies to value types in any OO language (if that condition does not apply then it is not a value type in the OO sense)


      My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      Z Offline
      Z Offline
      Zdeslav Vojkovic
      wrote on last edited by
      #33

      an integer is a value type (in .NET sense). this would mean that you can't change an integer. if you follow the same logic this should be illegal: System.Drawing.Rectangle rc = new System.Drawing.Rectangle(5, 10, 15, 20); rc.Offset(1,2); if i can offset a rectangle this way, it should also be possible to do it inside foreach statement.

      J 1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        Shog9 wrote: "the second greatest language ever to exist" This begs the question: What's the greatest language ever to exist? :) -- Oneigaishimasu! I blog too now[^]

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #34

        Forth, of course. ;)

        Shog9

        I'm not the Jack of Diamonds... I'm not the six of spades. I don't know what you thought; I'm not your astronaut...

        B 1 Reply Last reply
        0
        • M Marc Clifton

          Programmer2k4 wrote: Is VB .Net still for complete programming idiots? No. It's the other way around. VB creates programming idiots out of perfectly teachable, albeit inexperienced, programmers. This is an important distinction. We forget that we all (or almost all of us) have programmed in some sort of B language at one point or another. The lucky ones were able to mature out of their programming childhood. In other words, VB is like a bad parent. It can really screw up your childhood. Marc MyXaml Advanced Unit Testing YAPO

          G Offline
          G Offline
          Gary Thom
          wrote on last edited by
          #35

          Marc Clifton wrote: In other words, VB is like a bad parent. It can really screw up your childhood. I love it!! Can I use that as my sig? Gary Marc Clifton: "In other words, VB is like a bad parent. It can really screw up your childhood."

          M 1 Reply Last reply
          0
          • G Gary Thom

            Marc Clifton wrote: In other words, VB is like a bad parent. It can really screw up your childhood. I love it!! Can I use that as my sig? Gary Marc Clifton: "In other words, VB is like a bad parent. It can really screw up your childhood."

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #36

            Gary Thom wrote: Can I use that as my sig? Sure! :-D Marc MyXaml Advanced Unit Testing YAPO

            1 Reply Last reply
            0
            • J Jorgen Sigvardsson

              <misc-info>Did you know that the pope's last word was "Amen"?</misc-info> -- Oneigaishimasu! I blog too now[^]

              K Offline
              K Offline
              KaRl
              wrote on last edited by
              #37

              RIP :rose:


              Fold With Us! Chaos A.D. Disorder unleashed

              1 Reply Last reply
              0
              • M Marc Clifton

                Programmer2k4 wrote: Is VB .Net still for complete programming idiots? No. It's the other way around. VB creates programming idiots out of perfectly teachable, albeit inexperienced, programmers. This is an important distinction. We forget that we all (or almost all of us) have programmed in some sort of B language at one point or another. The lucky ones were able to mature out of their programming childhood. In other words, VB is like a bad parent. It can really screw up your childhood. Marc MyXaml Advanced Unit Testing YAPO

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

                Marc Clifton wrote: VB is like a bad parent. It can really screw up your childhood it can screw up your adulthood, too. after 18 months of forced VB-script, i find myself writing:

                if (c > 10) then
                {
                c = 10;
                }

                whenever i get to play with C++ again. Image Toolkits | Image Processing | Cleek

                D 1 Reply Last reply
                0
                • Z Zdeslav Vojkovic

                  jan larsen wrote: ICollection does not require an Add method, you only have to expose type loose methods if you're implementing eg. IList. That is why I rarely extends those interfaces IList is what i meant. i'm not using C# for last six months, so i already started to forget details :) jan larsen wrote: Que?, I don't think I can see the problem. What exactly is it that you want to do with the value type instance? And more important, how often do you actually have a collection of value types i find it really annoying that something like this is impossible: int[] ar = {1, 2, 3}; foreach (int i in ar) { i = i * 2; } of course, this is just a simplified example, but every so often i have a need to iterate over some simple data and change them. even worse, if it were reference type, it would also be impossible because the returned data is not a reference to real data, but to copy, which is essentially read-only, so foreach is generally usable only in read-only scenario. this just doesn't compile: string[] strs = {"aa", "bb", "cc"}; foreach (string s in strs) { s = s + "_x"; } jan larsen wrote: I totally disagree, using is so intuitive to use i know what's the use for "using" and that it is far better than try-finally, i believe that there is no need for both in the first place, and that it is just a hack. i simply don't like littering the language with workarounds for framework issues. i like the way it is done in C++/CLI when the object is automatically disposed when it goes out of scope (and i'm aware why this is not supported in C#)

                  A Offline
                  A Offline
                  Alvaro Mendez
                  wrote on last edited by
                  #39

                  Zdeslav Vojkovic wrote: i like the way it is done in C++/CLI when the object is automatically disposed when it goes out of scope (and i'm aware why this is not supported in C#) Yes, but if you ever take an object allocated on the stack and store its address (by pointer or reference) as an element of a collection (for later retrieval), BOOM! Regards, Alvaro


                  Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.

                  Z 1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    I am dead serious. VB is bad, but C# is a disaster. See this presentation[^] by Bjarne Stroustrup: The dilemma is real •The most elegant languages –(e.g. Smalltalk, ML, Haskell, Common Lisp) –Are not applicable for many important application areas –Are not efficient for many important problems –Are apparently not manageable for most programmers •The most efficient languages –(e.g. C, C++, Fortran) –Encourage low-level messing/hacking –Have problems expressing some important problems elegantly –Are hard to “restrain”for reasoning/analysis/transformation •Many language are neither fish nor fowl –(e.g. Java and C#) –Neither elegant nor efficient –Not applicable for many important application areas


                    My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.

                    S Offline
                    S Offline
                    Stan Shannon
                    wrote on last edited by
                    #40

                    C# is a disaster for anything aside from windows programming, and if you are using it for anything else, you're insane. As a windows application development language, C# (and .NET) are very nice indeed. "The Yahoos refused to be tamed."

                    D 1 Reply Last reply
                    0
                    • M Marc Clifton

                      Programmer2k4 wrote: Is VB .Net still for complete programming idiots? No. It's the other way around. VB creates programming idiots out of perfectly teachable, albeit inexperienced, programmers. This is an important distinction. We forget that we all (or almost all of us) have programmed in some sort of B language at one point or another. The lucky ones were able to mature out of their programming childhood. In other words, VB is like a bad parent. It can really screw up your childhood. Marc MyXaml Advanced Unit Testing YAPO

                      M Offline
                      M Offline
                      Mitch F
                      wrote on last edited by
                      #41

                      Hello, Interesting discussion going on here... Which language, in your opinion (anyone else is free to answer this too ;)) is the next best language for a VB .Net programmer to learn? Is C# a good introduction into C++? Or should I skip C# all together? Thanks, Programmer2k4 My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright I now use my CodeProject Blog! Most recent blog post: April 3

                      M 1 Reply Last reply
                      0
                      • M Mitch F

                        Hello, Interesting discussion going on here... Which language, in your opinion (anyone else is free to answer this too ;)) is the next best language for a VB .Net programmer to learn? Is C# a good introduction into C++? Or should I skip C# all together? Thanks, Programmer2k4 My sig: "And it is a professional faux pas to pay someone else to destroy your computer when you are perfectly capable of destroying it yourself." - Roger Wright I now use my CodeProject Blog! Most recent blog post: April 3

                        M Offline
                        M Offline
                        Marc Clifton
                        wrote on last edited by
                        #42

                        Programmer2k4 wrote: Is C# a good introduction into C++? Or should I skip C# all together? Frankly, both. They both have their strengths and weaknesses. It's probably better to learn their nuances, like the difference between templates and generics (C# 2.0), pointers vs. boxing/unboxing, managed vs. unmanaged, multiple inheritance vs. interfaces, etc. My 2c. Marc MyXaml Advanced Unit Testing YAPO

                        1 Reply Last reply
                        0
                        • S Stan Shannon

                          C# is a disaster for anything aside from windows programming, and if you are using it for anything else, you're insane. As a windows application development language, C# (and .NET) are very nice indeed. "The Yahoos refused to be tamed."

                          D Offline
                          D Offline
                          David Wulff
                          wrote on last edited by
                          #43

                          Why do you exclude web application development from that? ASP.NET with C# is like an orgasm on tap.


                          Ðavid Wulff The Royal Woofle Museum
                          Audioscrobbler :: flikr

                          Die Freiheit spielt auf allen Geigen

                          S 1 Reply Last reply
                          0
                          • C Chris Losinger

                            Marc Clifton wrote: VB is like a bad parent. It can really screw up your childhood it can screw up your adulthood, too. after 18 months of forced VB-script, i find myself writing:

                            if (c > 10) then
                            {
                            c = 10;
                            }

                            whenever i get to play with C++ again. Image Toolkits | Image Processing | Cleek

                            D Offline
                            D Offline
                            David Wulff
                            wrote on last edited by
                            #44

                            :rose:


                            Ðavid Wulff The Royal Woofle Museum
                            Audioscrobbler :: flikr

                            Die Freiheit spielt auf allen Geigen

                            C 1 Reply Last reply
                            0
                            • J Jorgen Sigvardsson

                              <misc-info>Did you know that the pope's last word was "Amen"?</misc-info> -- Oneigaishimasu! I blog too now[^]

                              C Offline
                              C Offline
                              Christian Graus
                              wrote on last edited by
                              #45

                              Nah, that's just propaganda. It was really uurgrhgghhhghghghghhhghghghgh. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

                              B 1 Reply Last reply
                              0
                              • C Christian Graus

                                Nah, that's just propaganda. It was really uurgrhgghhhghghghghhhghghghgh. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

                                B Offline
                                B Offline
                                brianwelsch
                                wrote on last edited by
                                #46

                                :laugh: Reminds me of this.... "The castle ARRRGH" "What?" "The castle ARRRGH" "What does that mean?" "He must have died while carving it." "Oh, come on. If he died he wouldn't write ARRRGH, he would just say it!" "Perhaps he was dictating." BW


                                I want pancakes! God, do you people understand every language except English?
                                Yo quiero pancakes. Donnez moi pancakes. Click click, bloody click pancakes!
                                -- Stewie Griffin

                                1 Reply Last reply
                                0
                                • D David Wulff

                                  :rose:


                                  Ðavid Wulff The Royal Woofle Museum
                                  Audioscrobbler :: flikr

                                  Die Freiheit spielt auf allen Geigen

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

                                  thanks man. it's been tough. Image Toolkits | Image Processing | Cleek

                                  1 Reply Last reply
                                  0
                                  • S Shog9 0

                                    Forth, of course. ;)

                                    Shog9

                                    I'm not the Jack of Diamonds... I'm not the six of spades. I don't know what you thought; I'm not your astronaut...

                                    B Offline
                                    B Offline
                                    brianwelsch
                                    wrote on last edited by
                                    #48

                                    Holy cow! Never thought I'd hear about that language again. BW


                                    I want pancakes! God, do you people understand every language except English?
                                    Yo quiero pancakes. Donnez moi pancakes. Click click, bloody click pancakes!
                                    -- Stewie Griffin

                                    S 1 Reply Last reply
                                    0
                                    • B brianwelsch

                                      Holy cow! Never thought I'd hear about that language again. BW


                                      I want pancakes! God, do you people understand every language except English?
                                      Yo quiero pancakes. Donnez moi pancakes. Click click, bloody click pancakes!
                                      -- Stewie Griffin

                                      S Offline
                                      S Offline
                                      Shog9 0
                                      wrote on last edited by
                                      #49

                                      :) To be honest, the last time i actually used it was a few years back. I was taking a class on web-dev with ASP, and getting bored with the projects... so for one i did a partial Forth interpreter in ASP, and implemented the rest of the project using it. Not the most modern of languages i guess, but hard to beat for pure fun...

                                      Shog9

                                      I'm not the Jack of Diamonds... I'm not the six of spades. I don't know what you thought; I'm not your astronaut...

                                      B 1 Reply Last reply
                                      0
                                      • S Shog9 0

                                        :) To be honest, the last time i actually used it was a few years back. I was taking a class on web-dev with ASP, and getting bored with the projects... so for one i did a partial Forth interpreter in ASP, and implemented the rest of the project using it. Not the most modern of languages i guess, but hard to beat for pure fun...

                                        Shog9

                                        I'm not the Jack of Diamonds... I'm not the six of spades. I don't know what you thought; I'm not your astronaut...

                                        B Offline
                                        B Offline
                                        brianwelsch
                                        wrote on last edited by
                                        #50

                                        I remember my dad messing around with Forth at home around 15-20 years ago maybe. He got all excited about improving some algorithm. I think I mumbled "That's nice" around a mouthful of King Vitmain cereal. :) Never got much beyond a quick look at his code, I was too busy playing soccer at the time. BW


                                        I want pancakes! God, do you people understand every language except English?
                                        Yo quiero pancakes. Donnez moi pancakes. Click click, bloody click pancakes!
                                        -- Stewie Griffin

                                        S 1 Reply Last reply
                                        0
                                        • B brianwelsch

                                          I remember my dad messing around with Forth at home around 15-20 years ago maybe. He got all excited about improving some algorithm. I think I mumbled "That's nice" around a mouthful of King Vitmain cereal. :) Never got much beyond a quick look at his code, I was too busy playing soccer at the time. BW


                                          I want pancakes! God, do you people understand every language except English?
                                          Yo quiero pancakes. Donnez moi pancakes. Click click, bloody click pancakes!
                                          -- Stewie Griffin

                                          S Offline
                                          S Offline
                                          Shog9 0
                                          wrote on last edited by
                                          #51

                                          Well, now's your chance to have a look... :D

                                          Shog9

                                          I'm not the Jack of Diamonds... I'm not the six of spades. I don't know what you thought; I'm not your astronaut...

                                          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