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. Glitch

Glitch

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
11 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.
  • V Viktor Signaievskyi

    I like this: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :) :laugh:

    W Offline
    W Offline
    walterhevedeich
    wrote on last edited by
    #2

    lol. By the way, you look like Adam Levine[^] of Maroon 5.

    Ignorance of the ability brings disability.

    V 1 Reply Last reply
    0
    • V Viktor Signaievskyi

      I like this: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :) :laugh:

      C Offline
      C Offline
      Chris Berger
      wrote on last edited by
      #3

      P1l19r1m wrote:

      #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :)

      Shouldn't that just be #define TRUE (rand() > 0.1) ? I guess I haven't used c++ in a while, but what happens when you use a circular define like that?

      1 Reply Last reply
      0
      • V Viktor Signaievskyi

        I like this: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :) :laugh:

        S Offline
        S Offline
        saxenaabhi6
        wrote on last edited by
        #4

        :omg: can we do that ?? i will put this in my mate's code ;P

        V 1 Reply Last reply
        0
        • V Viktor Signaievskyi

          I like this: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :) :laugh:

          T Offline
          T Offline
          TorstenFrings
          wrote on last edited by
          #5

          that's pure evil :) hopefully, there is no switch statement using this constant...

          1 Reply Last reply
          0
          • W walterhevedeich

            lol. By the way, you look like Adam Levine[^] of Maroon 5.

            Ignorance of the ability brings disability.

            V Offline
            V Offline
            Viktor Signaievskyi
            wrote on last edited by
            #6

            Thanks. Hope it was a compliment;)

            W 1 Reply Last reply
            0
            • S saxenaabhi6

              :omg: can we do that ?? i will put this in my mate's code ;P

              V Offline
              V Offline
              Viktor Signaievskyi
              wrote on last edited by
              #7

              You should do it!!! :-D

              1 Reply Last reply
              0
              • V Viktor Signaievskyi

                I like this: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers :) :laugh:

                V Offline
                V Offline
                Viktor Signaievskyi
                wrote on last edited by
                #8

                I've made some kind of mistake :(. "Copypasting" is evil :). As MSDN ( http://msdn.microsoft.com/en-us/library/398ax69y.aspx ) claims, rand() function returns a pseudorandom integer in the range 0 to RAND_MAX (32767). So, the preferable way is to use the following "working code": #define REALLYTRUE 1 #define REALLYFALSE 0 #define TRUE (rand() > (32762/2) ? REALLYTRUE : REALLYFALSE) // happy debugging losers P.S. If to compile this code: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers we will have an error like: c:\temp\win32\randex\randex.cpp(19) : error C2065: 'TRUE' : undeclared identifier But using the new version of code it will be "all right" :laugh:

                S 1 Reply Last reply
                0
                • V Viktor Signaievskyi

                  Thanks. Hope it was a compliment;)

                  W Offline
                  W Offline
                  walterhevedeich
                  wrote on last edited by
                  #9

                  Of course it is. :)

                  Ignorance of the ability brings disability.

                  V 1 Reply Last reply
                  0
                  • V Viktor Signaievskyi

                    I've made some kind of mistake :(. "Copypasting" is evil :). As MSDN ( http://msdn.microsoft.com/en-us/library/398ax69y.aspx ) claims, rand() function returns a pseudorandom integer in the range 0 to RAND_MAX (32767). So, the preferable way is to use the following "working code": #define REALLYTRUE 1 #define REALLYFALSE 0 #define TRUE (rand() > (32762/2) ? REALLYTRUE : REALLYFALSE) // happy debugging losers P.S. If to compile this code: #define TRUE (rand() > 0.1 ? TRUE : FALSE) // happy debugging losers we will have an error like: c:\temp\win32\randex\randex.cpp(19) : error C2065: 'TRUE' : undeclared identifier But using the new version of code it will be "all right" :laugh:

                    S Offline
                    S Offline
                    Stefan_Lang
                    wrote on last edited by
                    #10

                    Actually I liked the original version better as it will work in 32766 out of 32767 cases. Now try to reproduce that odd error! ;P

                    1 Reply Last reply
                    0
                    • W walterhevedeich

                      Of course it is. :)

                      Ignorance of the ability brings disability.

                      V Offline
                      V Offline
                      Viktor Signaievskyi
                      wrote on last edited by
                      #11

                      :)

                      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