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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Argh - C# can really SUCK !!!!

Argh - C# can really SUCK !!!!

Scheduled Pinned Locked Moved The Lounge
csharpxml
59 Posts 16 Posters 9 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.
  • C Chris Maunder

    A code sample would be helpful. cheers, Chris Maunder

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

    Yes, but then it would be a question, and in the wrong forum, and.... Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

    1 Reply Last reply
    0
    • D Daniel Turini

      Christian Graus wrote: I have a method which returns a bool for success or failure, and takes an XPath and an int, the int gets populated with the value of the XPath. The XPath is turned into a node calling an internal function called 'FindNode'. Here's the rub. If I make the int a ref, it won't compile unless I give it an initial value. If I make it an out, I can't compile at all, because I call an external function within my function. I need to give i a default value within my function, just to make it compile..... It's more probable there's a mistake in your design. Think the 'out' attribute on a parameter the same as the const-ness of a C++ variable. You shouldn't cast-out a const to a non-const. Probably you are passing the out parameter to a function as a non-out parameter. This is a no-no. "In an organization, each person rises to the level of his own incompetence." Peter's Principle

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

      Daniel Turini wrote: Probably you are passing the out parameter to a function as a non-out parameter. This is a no-no. No, I am not. I am doing exactly what I said I am doing. class A { void MyFunction(out int i) { string s = MyOtherFunc(); i = ParseString(s); } string MyOtherFunc()...; int ParseString()....; } int a; m_A.MyFunction(out a); This won't work unless I give i some value BEFORE calling MyOtherFunc. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

      D 1 Reply Last reply
      0
      • P Paul Watson

        Shaun Wilde wrote: but nothing on SVG. but I think your right it is better to stick with a standard. Christian and I are both submitting SVG articles soon, so there should be some good fodder in there. Plus there is quite a bit on the net, just ask if you want links and feel free to ask questions here on the forums.

        Paul Watson
        Bluegrass
        Cape Town, South Africa

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

        Paul Watson wrote: Christian and I are both submitting SVG articles soon I better get going, mine is going to be very 'beginner', so I'll have to beat you for mine to be worth anything !!! Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

        1 Reply Last reply
        0
        • S Senkwe Chanda

          Hmmm, I'm not sure I understand (maybe we need to see some code first). All I know is that to pass an argument to a ref parameter, you have to initialize it first. At least thats the way I read the C# Reference on the topic. ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff

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

          I'm actually quite fine with that, it's the mix of that with the out being unpassable unless the first line of the function sets a value to the out parameter that had me frustrated, it meant I was damned either way. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

          1 Reply Last reply
          0
          • G George

            Christian Graus wrote: Because asp.net absolutely leaves 'classic' asp for dead. It's the .net 'killer app'. And the odds of be using VB EVER are zero. Why don't you use C++ (or MC++ for that matter) if you need something that works with asp.net instead of C#? I thought that was the whole point of MC++? And by the way - why are you wasting your time with asp as well? ;)

            /* I C++, therefore I am... */

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

            George wrote: Why don't you use C++ (or MC++ for that matter) if you need something that works with asp.net instead of C#? I thought that was the whole point of MC++? Because a. MC++ is an abortion IMO b. You can't use MC++ within a page AFAIK. George wrote: And by the way - why are you wasting your time with asp as well? How is it a waste of time ? It's a powerful way to provide a presentation layer for most corporate apps nowadays - everyone has a browser. In any case, I like to learn new things and I like to increase my skills in areas that are interesting, or that pay. I will inevitably do ASP.NET in C# at work, so it seems wise to learn it first at home. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

            1 Reply Last reply
            0
            • C CodeGuy

              William E. Kempf wrote: 2) Garbage collection was actually proposed for the last standard, though it got little attention AFAIK, because of scope and time constraints. But the language was specifically defined to allow for GC from day one, and most members have had some interest in a standardized GC addition to the language. Once you get over the (vague and basically unwarranted) fears about GC, there's no logical reason not to add this one. Except unlike threading or networking support (which occurs across many different platforms), GC and VM support doesn't. These requirements are not coming out of the blue, or postponed from a prior meeting -- Herb makes it pretty clear in his article MS is interested in making C++ target .NET. This is FUD?? As you mentioned in your point #1, MS has shown zero interest in the past in the Standard. Essentially, they sat on their hands for 6 years or so while we had a crap version of STL and no worthwhile template support. Now they have a new version of C++ that is rooted in .NET with GC & VM support, but still will not compile many third-party libraries according to the current Standard. Again, it's pretty clear that MS is attempting to change the Standard to match MC++, while the current Standard hasn't even been complied with! Who are they kidding? I'm not scared by the addition of GC & VM features to the Standard*. I am scared by the presence of a 900-pound gorilla on the Committee who will attempt to bully a Standard through that suits them and no one else. Brandon * Although I do think the Standard is already weighed down by its own complexity. I think more attention should be given toward simplification of existing features rather than new libraries.

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

              CodeGuy wrote: Although I do think the Standard is already weighed down by its own complexity. I think more attention should be given toward simplification of existing features rather than new libraries. I agree - I spoke with Herb recently about my feelings regarding his article, which I still think was little more than pimping MC++, although after speaking with him, I believe that he did not set out to write it with such a cynical goal. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

              1 Reply Last reply
              0
              • T Tomasz Sowinski

                I still don't understand :) You mean that out parameters can't be used in functions which call other functions?? Tomasz Sowinski -- http://www.shooltz.com

                *** Vodka. Connecting people. ***

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

                Tomasz Sowinski wrote: You mean that out parameters can't be used in functions which call other functions?? No, they can be used, but the out parameter needs to be assigned a value before you call anything else. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

                L 1 Reply Last reply
                0
                • C Christian Graus

                  Daniel Turini wrote: Probably you are passing the out parameter to a function as a non-out parameter. This is a no-no. No, I am not. I am doing exactly what I said I am doing. class A { void MyFunction(out int i) { string s = MyOtherFunc(); i = ParseString(s); } string MyOtherFunc()...; int ParseString()....; } int a; m_A.MyFunction(out a); This won't work unless I give i some value BEFORE calling MyOtherFunc. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

                  D Offline
                  D Offline
                  Daniel Turini
                  wrote on last edited by
                  #56

                  Well, you're doing something wrong (I love saying I'm right): This compiles and runs fine: using System; namespace cspteste { /// /// Summary description for Class1. /// class Class1 { class ATest { public void MyFunction(out int i) { string s = MyOtherFunc(); i = ParseString(s); } string MyOtherFunc() { return "50"; } int ParseString(string temp) { return Convert.ToInt32(temp); } } [STAThread] static void Main(string[] args) { ATest a = new ATest(); int x; a.MyFunction(out x); Console.WriteLine(x); } } } "In an organization, each person rises to the level of his own incompetence." Peter's Principle

                  C 1 Reply Last reply
                  0
                  • D Daniel Turini

                    Well, you're doing something wrong (I love saying I'm right): This compiles and runs fine: using System; namespace cspteste { /// /// Summary description for Class1. /// class Class1 { class ATest { public void MyFunction(out int i) { string s = MyOtherFunc(); i = ParseString(s); } string MyOtherFunc() { return "50"; } int ParseString(string temp) { return Convert.ToInt32(temp); } } [STAThread] static void Main(string[] args) { ATest a = new ATest(); int x; a.MyFunction(out x); Console.WriteLine(x); } } } "In an organization, each person rises to the level of his own incompetence." Peter's Principle

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

                    Daniel Turini wrote: Well, you're doing something wrong My wife tells me that ALL the time.... The code I posted was off the top of my head, but the actual code, which wouldn't compile until I gave i a value, was very similar, but bigger. I'll have to have a look when I get home, I *know* that every execution path gave 'i' a value, and the compiler error said I was not able to call external functions before assigning a value to i. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

                    D 1 Reply Last reply
                    0
                    • C Christian Graus

                      Daniel Turini wrote: Well, you're doing something wrong My wife tells me that ALL the time.... The code I posted was off the top of my head, but the actual code, which wouldn't compile until I gave i a value, was very similar, but bigger. I'll have to have a look when I get home, I *know* that every execution path gave 'i' a value, and the compiler error said I was not able to call external functions before assigning a value to i. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

                      D Offline
                      D Offline
                      Daniel Turini
                      wrote on last edited by
                      #58

                      Ok. Post it when you arrive home, I'm very curious about it. "In an organization, each person rises to the level of his own incompetence." Peter's Principle

                      1 Reply Last reply
                      0
                      • C Christian Graus

                        Tomasz Sowinski wrote: You mean that out parameters can't be used in functions which call other functions?? No, they can be used, but the out parameter needs to be assigned a value before you call anything else. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

                        L Offline
                        L Offline
                        leppie
                        wrote on last edited by
                        #59

                        Christian Graus wrote: but the out parameter needs to be assigned a value before you call anything else. This is a bit dumb, I just use ref most of the time. It does become handy when you want to re-use a variable, IOW say you have an int called var1, but the value has been assigned to it, now you pass that int as an out parameter, now the value wont be passed into the function , where a ref parameter would pass the value. I cant really think of an example from the top of my head though :) Cheers :) Give them a chance! Do it for the kittens, dear God, the kittens! As seen on MS File Transfer: Please enter an integer between 1 and 2.

                        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