Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38

Thread: C# is a strange language

  1. #21
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: C# is a strange language

    Quote Originally Posted by snip3r8 View Post
    For example

    Code:
    bool check = true;
    
    for(int i =0;i < 2;i++)
    {
             check = !check;
             if(check)
             {
                     Console.WriteLine("Hello World");
             }
    }
    this will print "Hello World" twice (but only sometimes).
    This claim was amazing. So amazing I downloaded Monodevelop to try it myself!

    Here is my code:
    Code:
    using System;
    
    namespace Test
    {
    	class MainClass
    	{
    		public static void Main (string[] args)
    		{
    			int wrong = 0;
    			for (int j = 0; j < 500000; j++)
    			{
    				bool check = true;
    
    				int testVal = 0;
    				for(int i =0;i < 2;i++)
    				{
    					check = !check;
    					if(check)
    					{
    						testVal++;
    					}
    				}
    				
    				if (testVal == 2)
    				{
    					wrong++;
    				}	
    			}
    			
    			Console.WriteLine("There were " + wrong + " wrong");
    		}
    	}
    }
    This prints:
    Code:
    There were 0 wrong
    Which is exactly what I would expect. I can't make it do the weird stuff you mentioned.

    Paul

  2. #22
    Join Date
    Sep 2009
    Location
    Canada, Montreal QC
    Beans
    1,809
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: C# is a strange language

    I don't know how true that statement was, but a language that does random things like that is not reliable.
    Last edited by cgroza; September 6th, 2011 at 12:00 AM.
    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
    Freedom is measured in Stallmans.
    Projects: gEcrit

  3. #23
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: C# is a strange language

    True. I guess in addition you have to consider is the bytecode being compiled incorrectly or is the runtime interpretting it wrongly. Either way, it works fine on my Pc.

    Paul

  4. #24
    Join Date
    Mar 2010
    Location
    South Africa
    Beans
    341
    Distro
    Ubuntu

    Re: C# is a strange language

    Quote Originally Posted by PaulM1985 View Post
    This claim was amazing. So amazing I downloaded Monodevelop to try it myself!

    Here is my code:
    Code:
    using System;
    
    namespace Test
    {
        class MainClass
        {
            public static void Main (string[] args)
            {
                int wrong = 0;
                for (int j = 0; j < 500000; j++)
                {
                    bool check = true;
    
                    int testVal = 0;
                    for(int i =0;i < 2;i++)
                    {
                        check = !check;
                        if(check)
                        {
                            testVal++;
                        }
                    }
                    
                    if (testVal == 2)
                    {
                        wrong++;
                    }    
                }
                
                Console.WriteLine("There were " + wrong + " wrong");
            }
        }
    }
    This prints:
    Code:
    There were 0 wrong
    Which is exactly what I would expect. I can't make it do the weird stuff you mentioned.

    Paul

    It only does it in visual studio , I think its the Visual Studio compiler because its even happened to me in C++ one time. Microsoft...
    Registered Linux user: #543082
    Registered Ubuntu user: #34219
    http://dvisagie.com/


  5. #25
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: C# is a strange language

    Quote Originally Posted by snip3r8 View Post
    It only does it in visual studio , I think its the Visual Studio compiler because its even happened to me in C++ one time. Microsoft...
    Using Microsoft Visual Studio 2010 and .NET 4.0 on Windows 7, I still can't reproduce the issue you are talking about.

    I think C# is a good language. I have found it to be quite reliable and easy to use, especially moving to it from a Java background. It's ability to use C and C++ code also makes it great for building on top of old systems with "tried and tested" libraries without having to re-write stuff for a new programming language/technology.

    Paul

  6. #26
    Join Date
    Sep 2006
    Location
    BC, Canada
    Beans
    347
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: C# is a strange language

    Rather than start a new thread I thought this might be a good place to ask this opinion question: Though C# is an OS agnostic language due to the Mono project, is there any concern of "vendor lock-in" with the language? Especially concerning it's relation to the .Net framework which was designed to be Windows-only? Does the legal shadow over the project worry anyone? I've always avoided C# for this reason but I wonder if it's FUD spread by the FOSS community or are the worries well founded?

  7. #27
    Join Date
    Jul 2008
    Location
    England
    Beans
    866

    Re: C# is a strange language

    I think that possibly there may be some issue. As the language (or rather Windows implementation) grows it may be that open source projects can't keep up with the rate of growth. This has already happened in the Mono project in that they have said that they will not be providing support for Windows Presentation Framework (WPF) which is a new way of developing user interfaces in .NET.

    Paul

  8. #28
    Join Date
    Mar 2010
    Location
    South Africa
    Beans
    341
    Distro
    Ubuntu

    Re: C# is a strange language

    Quote Originally Posted by JupiterV2 View Post
    Rather than start a new thread I thought this might be a good place to ask this opinion question: Though C# is an OS agnostic language due to the Mono project, is there any concern of "vendor lock-in" with the language? Especially concerning it's relation to the .Net framework which was designed to be Windows-only? Does the legal shadow over the project worry anyone? I've always avoided C# for this reason but I wonder if it's FUD spread by the FOSS community or are the worries well founded?
    I have heard that Microsoft actually helped out a lot with mono ,so I'm not worried.
    Registered Linux user: #543082
    Registered Ubuntu user: #34219
    http://dvisagie.com/


  9. #29
    Join Date
    Dec 2008
    Location
    Deep Woods of PA
    Beans
    699
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: C# is a strange language

    Quote Originally Posted by JupiterV2 View Post
    Though C# is an OS agnostic language due to the Mono project, is there any concern of "vendor lock-in" with the language?
    I don't think so although the stigma exists in addition the development of the language and hence its standardization is done almost entirely by Microsoft, who only supports it's own operating system.. (I am still surprised that Office for Mac exists).

    Especially concerning it's relation to the .Net framework which was designed to be Windows-only?
    That got nothing to do with the programming language per-se just as it was designed for it.

    Does the legal shadow over the project worry anyone?
    Not sure what legal shadow you are referring to?

    I've always avoided C# for this reason but I wonder if it's FUD spread by the FOSS community or are the worries well founded?
    The reason is mostly stigma but in addition as far as I can tell C# standard is only 5 years and non-Microsoft specific C# libraries and toolkits are few so why switch to use C# on Linux/Solaris/MacOS etc, when you can use C/C++ or Objective-C on a Mac, which have 20-30 years under their belts and quite a bit of tools already written?

    The only way I could see mass acceptance of C# as a development platform on Linux for example is that there is a significant push from a major commercial player that does its own software development to dump Microsoft as a desktop platform of choice and even then I see better chance of using Java then C#.
    Regards,

    Karlson

  10. #30
    Join Date
    Dec 2008
    Location
    Deep Woods of PA
    Beans
    699
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: C# is a strange language

    Quote Originally Posted by snip3r8 View Post
    I have heard that Microsoft actually helped out a lot with mono ,so I'm not worried.
    With what exactly?
    Regards,

    Karlson

Page 3 of 4 FirstFirst 1234 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •