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. Assignment Statement Considered Harmful

Assignment Statement Considered Harmful

Scheduled Pinned Locked Moved The Lounge
csharpc++htmlcomlearning
40 Posts 29 Posters 1 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.
  • N Offline
    N Offline
    Nemanja Trifunovic
    wrote on last edited by
    #1

    After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

    utf8-cpp

    E A Y C S 12 Replies Last reply
    0
    • N Nemanja Trifunovic

      After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

      utf8-cpp

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      I believe one of the early programming languages allowed literals to be overwritten in code with the assignment operator.

      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me

      G B 2 Replies Last reply
      0
      • N Nemanja Trifunovic

        After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

        utf8-cpp

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #3

        Nemanja Trifunovic wrote:

        Assignment Statement Considered Harmful

        So is salt, butter, oil, and dihydrogen monoxide (in large enough quantities). ;)

        [Forum Guidelines]

        Q E 2 Replies Last reply
        0
        • N Nemanja Trifunovic

          After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

          utf8-cpp

          Y Offline
          Y Offline
          Yusuf
          wrote on last edited by
          #4

          Ok, next month's competition Write a piece of code with the following condition a. You can't use goto (very simple) b. You can't use if statement c. You can't use for loops d. You can't use assignment statements. Good luck :rolleyes:

          Yusuf May I help you?

          OriginalGriffO R E 0 L 6 Replies Last reply
          0
          • N Nemanja Trifunovic

            After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

            utf8-cpp

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

            this just in: functional language programmer thinks functional languages are better than imperative languages and tries to prove it by asserting that imperative languages programmers don't understand what they're doing; hilarity ensues.

            image processing toolkits | batch image processing

            E 1 Reply Last reply
            0
            • N Nemanja Trifunovic

              After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

              utf8-cpp

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

              Programming is harmful, especially for some individuals. X| There are cases when I’m sorry that I’m using my real name here, so I can’t go into details.

              The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

              E 1 Reply Last reply
              0
              • Y Yusuf

                Ok, next month's competition Write a piece of code with the following condition a. You can't use goto (very simple) b. You can't use if statement c. You can't use for loops d. You can't use assignment statements. Good luck :rolleyes:

                Yusuf May I help you?

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

                Too easy, you need to add: e. Make it do something useful.

                Did you know: That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.

                "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

                A 1 Reply Last reply
                0
                • A AspDotNetDev

                  Nemanja Trifunovic wrote:

                  Assignment Statement Considered Harmful

                  So is salt, butter, oil, and dihydrogen monoxide (in large enough quantities). ;)

                  [Forum Guidelines]

                  Q Offline
                  Q Offline
                  QuiJohn
                  wrote on last edited by
                  #8

                  aspdotnetdev wrote:

                  and dihydrogen monoxide (in large enough quantities)

                  What do you mean? I've literally been swimming in it.


                  He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.

                  A N 2 Replies Last reply
                  0
                  • A AspDotNetDev

                    Nemanja Trifunovic wrote:

                    Assignment Statement Considered Harmful

                    So is salt, butter, oil, and dihydrogen monoxide (in large enough quantities). ;)

                    [Forum Guidelines]

                    E Offline
                    E Offline
                    El Corazon
                    wrote on last edited by
                    #9

                    aspdotnetdev wrote:

                    dihydrogen monoxide (in large enough quantities).

                    actually, my little brother died from excessive inhalation of dihydrogen monoxide... However, I don't call for it's ban because I am so addicted to it that I literally shower in it every morning.... I don't go a day without showering in the stuff....

                    _________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....

                    1 Reply Last reply
                    0
                    • S Single Step Debugger

                      Programming is harmful, especially for some individuals. X| There are cases when I’m sorry that I’m using my real name here, so I can’t go into details.

                      The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

                      E Offline
                      E Offline
                      El Corazon
                      wrote on last edited by
                      #10

                      Deyan Georgiev wrote:

                      Programming is harmful

                      I don't see what how that is possible... it isn't like programs launch missiles or anything... err... oh... wait.....

                      _________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....

                      S 1 Reply Last reply
                      0
                      • E Ennis Ray Lynch Jr

                        I believe one of the early programming languages allowed literals to be overwritten in code with the assignment operator.

                        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me

                        G Offline
                        G Offline
                        Gary Wheeler
                        wrote on last edited by
                        #11

                        PL/I.

                        Software Zen: delete this;

                        1 Reply Last reply
                        0
                        • C Chris Losinger

                          this just in: functional language programmer thinks functional languages are better than imperative languages and tries to prove it by asserting that imperative languages programmers don't understand what they're doing; hilarity ensues.

                          image processing toolkits | batch image processing

                          E Offline
                          E Offline
                          Ennis Ray Lynch Jr
                          wrote on last edited by
                          #12

                          I just wonder where functional programmers store the result of your statement.

                          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me

                          N 1 Reply Last reply
                          0
                          • Q QuiJohn

                            aspdotnetdev wrote:

                            and dihydrogen monoxide (in large enough quantities)

                            What do you mean? I've literally been swimming in it.


                            He said, "Boy I'm just old and lonely, But thank you for your concern, Here's wishing you a Happy New Year." I wished him one back in return.

                            A Offline
                            A Offline
                            AspDotNetDev
                            wrote on last edited by
                            #13

                            Mercury can be lethal in large quantities too, but not if those large quantities are on a planet you are not on. All depends on how you use it. It can be lethal in large quantites if inhaled or injected (or shot out of a dihydrogen monoxide gun that propels the substance at a sufficient velocity into your brain).

                            [Forum Guidelines]

                            A 1 Reply Last reply
                            0
                            • A AspDotNetDev

                              Mercury can be lethal in large quantities too, but not if those large quantities are on a planet you are not on. All depends on how you use it. It can be lethal in large quantites if inhaled or injected (or shot out of a dihydrogen monoxide gun that propels the substance at a sufficient velocity into your brain).

                              [Forum Guidelines]

                              A Offline
                              A Offline
                              AspDotNetDev
                              wrote on last edited by
                              #14

                              aspdotnetdev wrote:

                              not if those large quantities are on a planet you are not on

                              Actually, that could be lethal too, if the gravity is sufficient to cause a sheer force that rips you apart.

                              [Forum Guidelines]

                              F 1 Reply Last reply
                              0
                              • E Ennis Ray Lynch Jr

                                I believe one of the early programming languages allowed literals to be overwritten in code with the assignment operator.

                                Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me

                                B Offline
                                B Offline
                                Brady Kelly
                                wrote on last edited by
                                #15

                                I've had four beers, but that makes sense. A literal is basically an anonymous object. The following is not allowed in C#, but I think it illustrates the concept of assigning to a literal quite nicely, and we all know how promiscuous older languages were compared to our beloved.

                                        var lit = new {Name = "Brady"};
                                        lit.Name = "Ennis";
                                
                                E 1 Reply Last reply
                                0
                                • E Ennis Ray Lynch Jr

                                  I just wonder where functional programmers store the result of your statement.

                                  Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me

                                  N Offline
                                  N Offline
                                  Nish Nishant
                                  wrote on last edited by
                                  #16

                                  Ennis Ray Lynch, Jr. wrote:

                                  I just wonder where functional programmers store the result of your statement.

                                  In a closure.

                                  Regards, Nish


                                  Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

                                  K 1 Reply Last reply
                                  0
                                  • Y Yusuf

                                    Ok, next month's competition Write a piece of code with the following condition a. You can't use goto (very simple) b. You can't use if statement c. You can't use for loops d. You can't use assignment statements. Good luck :rolleyes:

                                    Yusuf May I help you?

                                    R Offline
                                    R Offline
                                    Rajesh R Subramanian
                                    wrote on last edited by
                                    #17

                                    Yusuf wrote:

                                    Write a piece of code with the following condition a. You can't use goto (very simple) b. You can't use if statement c. You can't use for loops d. You can't use assignment statements.

                                    //#include <iostream> //wait... we don't any of those!

                                    int main()
                                    {
                                    return; //usage of return is NOT yet banned.
                                    }

                                    It's time for a new sig. Seriously.

                                    M 1 Reply Last reply
                                    0
                                    • N Nemanja Trifunovic

                                      After we figured out that goto is bad[^] and established that if statement is not much better[^], and of course for loops should be avoided at all cost[^] it is time for another logical step in that direction: ladies and gentlemen I give you Assignment Statement Considered Harmful[^].

                                      utf8-cpp

                                      R Offline
                                      R Offline
                                      Ravi Bhavnani
                                      wrote on last edited by
                                      #18

                                      On a (somewhat) related note, I found Big Ball of Mud[^] to be an excellent read. /ravi

                                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                                      R 1 Reply Last reply
                                      0
                                      • E El Corazon

                                        Deyan Georgiev wrote:

                                        Programming is harmful

                                        I don't see what how that is possible... it isn't like programs launch missiles or anything... err... oh... wait.....

                                        _________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....

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

                                        Yes!

                                        The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

                                        1 Reply Last reply
                                        0
                                        • N Nish Nishant

                                          Ennis Ray Lynch, Jr. wrote:

                                          I just wonder where functional programmers store the result of your statement.

                                          In a closure.

                                          Regards, Nish


                                          Blog: blog.voidnish.com Most recent article: An MVVM friendly approach to adding system menu entries in a WPF application

                                          K Offline
                                          K Offline
                                          Keith Barrow
                                          wrote on last edited by
                                          #20

                                          Obligatory XKCD reference: http://xkcd.com/297/[^]

                                          ragnaroknrol The Internet is For Porn[^]
                                          Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.

                                          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