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 Weird and The Wonderful
  4. Ugh

Ugh

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
8 Posts 6 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.
  • J Offline
    J Offline
    jamie550
    wrote on last edited by
    #1

    What was I thinking?

    	private static ProtoBlock LoadBlock(int x, int y, ByteReader stream, BlockHolder\[,\] blocks)
    	{
    		if (stream == null)
    			return RadishHelper.LoadBlockData(x, y, blocks, null);
    		return RadishHelper.LoadBlockData(x, y, blocks, stream);
    	}
    

    Firstly, there is no need to check for null, as it is quite possible to pass null values on if it is a null. Secondly, since the first point is true, this method only calls the other method, with no logic whatsoever. :doh:

    CPalliniC M T 3 Replies Last reply
    0
    • J jamie550

      What was I thinking?

      	private static ProtoBlock LoadBlock(int x, int y, ByteReader stream, BlockHolder\[,\] blocks)
      	{
      		if (stream == null)
      			return RadishHelper.LoadBlockData(x, y, blocks, null);
      		return RadishHelper.LoadBlockData(x, y, blocks, stream);
      	}
      

      Firstly, there is no need to check for null, as it is quite possible to pass null values on if it is a null. Secondly, since the first point is true, this method only calls the other method, with no logic whatsoever. :doh:

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Oh, it's simply self-encouraging code. :rolleyes:

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      In testa che avete, signor di Ceprano?

      1 Reply Last reply
      0
      • J jamie550

        What was I thinking?

        	private static ProtoBlock LoadBlock(int x, int y, ByteReader stream, BlockHolder\[,\] blocks)
        	{
        		if (stream == null)
        			return RadishHelper.LoadBlockData(x, y, blocks, null);
        		return RadishHelper.LoadBlockData(x, y, blocks, stream);
        	}
        

        Firstly, there is no need to check for null, as it is quite possible to pass null values on if it is a null. Secondly, since the first point is true, this method only calls the other method, with no logic whatsoever. :doh:

        M Offline
        M Offline
        MarkB777
        wrote on last edited by
        #3

        jamie550 wrote:

        What was I thinking?

        About how sweet it will be when you finish up, and can go have a beer at the pub perhaps? :D

        Mark Brock Click here to view my blog

        1 Reply Last reply
        0
        • J jamie550

          What was I thinking?

          	private static ProtoBlock LoadBlock(int x, int y, ByteReader stream, BlockHolder\[,\] blocks)
          	{
          		if (stream == null)
          			return RadishHelper.LoadBlockData(x, y, blocks, null);
          		return RadishHelper.LoadBlockData(x, y, blocks, stream);
          	}
          

          Firstly, there is no need to check for null, as it is quite possible to pass null values on if it is a null. Secondly, since the first point is true, this method only calls the other method, with no logic whatsoever. :doh:

          T Offline
          T Offline
          ToreUp
          wrote on last edited by
          #4

          Well, there is this curious item: BlockHolder[,]:confused:

          S 1 Reply Last reply
          0
          • T ToreUp

            Well, there is this curious item: BlockHolder[,]:confused:

            S Offline
            S Offline
            Steve Hansen
            wrote on last edited by
            #5

            That is one of the 2 ways to declare a multi-array, the other way is [][]

            R T 2 Replies Last reply
            0
            • S Steve Hansen

              That is one of the 2 ways to declare a multi-array, the other way is [][]

              R Offline
              R Offline
              Rob Grainger
              wrote on last edited by
              #6

              I believe there's a difference: int x[][] will declare an array of arrays of integers, each of which may be initialised with its own number of elements (i.e. a jagged array). int x[,] declares a 2-dimensional array, where the bounds of each dimension are specified when created and fixed.

              S 1 Reply Last reply
              0
              • R Rob Grainger

                I believe there's a difference: int x[][] will declare an array of arrays of integers, each of which may be initialised with its own number of elements (i.e. a jagged array). int x[,] declares a 2-dimensional array, where the bounds of each dimension are specified when created and fixed.

                S Offline
                S Offline
                Steve Hansen
                wrote on last edited by
                #7

                I didn't say they were the same :) but yes you are right about both of them.

                1 Reply Last reply
                0
                • S Steve Hansen

                  That is one of the 2 ways to declare a multi-array, the other way is [][]

                  T Offline
                  T Offline
                  ToreUp
                  wrote on last edited by
                  #8

                  Yeah... ugh. I was unaware of that use of the comma operator. Before posting my ignorance of it, I looked up the comma operator in C#, but didn't find that usage. Thanks for the "pointer". ;-)

                  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