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 Back Room
  4. I hate "C" code

I hate "C" code

Scheduled Pinned Locked Moved The Back Room
question
25 Posts 12 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.
  • A Atlantys

    I saw this at work last week: #define void int :wtf::omg: That's why I ramble so much. If you're short and quotable, there's a much greater danger of ending up in a sig. [Christopher Duncan on how to prevent yourself from ending up in a sig]

    S Offline
    S Offline
    Shog9 0
    wrote on last edited by
    #14

    Ugh. That's pretty fucked up right there...! Shog9 ------

    Rather hammer futiley at the locked door than just sit and ignore it. Obviously finding a way to get through the locked door would be even better though. - Paul Watson, My Ignorance

    A 1 Reply Last reply
    0
    • S Shog9 0

      Ugh. That's pretty fucked up right there...! Shog9 ------

      Rather hammer futiley at the locked door than just sit and ignore it. Obviously finding a way to get through the locked door would be even better though. - Paul Watson, My Ignorance

      A Offline
      A Offline
      Atlantys
      wrote on last edited by
      #15

      I wish I could just give him/her a smack-upside-the-head with a "what were you thinking foo!?" :-D That's why I ramble so much. If you're short and quotable, there's a much greater danger of ending up in a sig. [Christopher Duncan on how to prevent yourself from ending up in a sig]

      1 Reply Last reply
      0
      • A Atlantys

        I saw this at work last week: #define void int :wtf::omg: That's why I ramble so much. If you're short and quotable, there's a much greater danger of ending up in a sig. [Christopher Duncan on how to prevent yourself from ending up in a sig]

        C Offline
        C Offline
        ColinDavies
        wrote on last edited by
        #16

        hmmmm Interesting I think I can find some uses for that, " In other peoples code " :-) Regardz Colin J Davies

        Sonork ID 100.9197:Colin

        You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.

        1 Reply Last reply
        0
        • M Maximilien

          #define DoubleFloat double
          typedef double *DoubleFloatPtr;
          typedef double **DoubleFloatPtr2D;
          typedef double ***DoubleFloatPtr3D;
          typedef double ****DoubleFloatPtr4D;

          What the hell is a DoubleFloat, a double, a float, a double precision float ? hell no, it's simply a freaking double !!! and

          void someFuc ( const void * const * const args )
          {
          ...
          }

          First time I read this, my first reaction was, whoa, there's some missing comma and parameters there, I even was looking for old C style parameters !!! X| X| X| Max

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #17

          Maximilien wrote: void someFuc ( const void * const * const args ) args is a constant pointer, to a constant pointer to constant void. You have no reason to write code like this except for the IOCCC[^]. ;) --Mike-- "alyson hannigan is so cute it's crazy" -- Googlism Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

          1 Reply Last reply
          0
          • J James T Johnson

            Yep, MFC does it for debug builds snippet from some code I had laying around

            #ifdef _DEBUG
            #define new DEBUG_NEW
            #undef THIS_FILE
            static char THIS_FILE[] = __FILE__;
            #endif

            It works because to my knowledge the preprocessor does all of its work before anything language specific gets handled. James - out of order -

            J Offline
            J Offline
            jan larsen
            wrote on last edited by
            #18

            Actually, I think it works because new is a function which can be overloaded and overridden. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

            J 1 Reply Last reply
            0
            • C Christian Graus

              :wtf::omg::omg::wtf: I hate typedefs, the place I see them most is used to obsfucate STL code. I'm sure they have uses, but I'm equally sure that this isn't it.... Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 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

              J Offline
              J Offline
              Jorgen Sigvardsson
              wrote on last edited by
              #19

              Christian Graus wrote: I hate typedefs, the place I see them most is used to obsfucate STL code Hoooooold your horses mate.

              template <typename T, int SIZE>
              class array {
              T arr[SIZE];
              /* more stuff here */
              public:
              typedef T* iterator;
              typedef const T* const_iterator;

              iterator begin(); 
              iterator end();
              /\* and some more stuff \*/
              

              };

              also

              class SomeClass {
              typedef std::list<SomeType> SomeTypeContainer;
              typedef SomeTypeList::iterator SomeTypeContainerIterator;

              void SomeMethod() {
                   SomeTypeContainerIterator i = m\_list.begin(), end = m\_list.end();
                   //std::list<SomeType>::iterator i = m\_list.begin(), ... 
                   while(i != end) {
                        // Do magic
                   }
              }
              

              };

              typedef hides implementation details, and it may save a lot of typing (ponder the case where you figure you want to replace std::list with std::vector for whatever reason. A lot less to change in the code if you typedef it). It's not all obfuscated. -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

              C 1 Reply Last reply
              0
              • L loket

                Sit down and take a deep breath until your heart beats normally again. I was not serious, this is the sopabox after all. ..and im sooo bored. :) /M


                - Don't sweat the petty things, and don't pet the sweaty things.

                J Offline
                J Offline
                Jorgen Sigvardsson
                wrote on last edited by
                #20

                Haha! I'll have to try that trick some day... ;D Another interesting trick would be to #define public private and see if the other programmers will figure out what the hell is wrong. Muhahah! I think I'll have some fun at work some day :) -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

                L 1 Reply Last reply
                0
                • J jan larsen

                  Actually, I think it works because new is a function which can be overloaded and overridden. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

                  J Offline
                  J Offline
                  Jorgen Sigvardsson
                  wrote on last edited by
                  #21

                  No. It's just like James T Johnson says. The preprocessor handles the text before it passes it on to the compiler. -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

                  1 Reply Last reply
                  0
                  • A Atlantys

                    I saw this at work last week: #define void int :wtf::omg: That's why I ramble so much. If you're short and quotable, there's a much greater danger of ending up in a sig. [Christopher Duncan on how to prevent yourself from ending up in a sig]

                    J Offline
                    J Offline
                    Jorgen Sigvardsson
                    wrote on last edited by
                    #22

                    Now that can't have any validity. Unless it's used to drive someone else to insanity.. :) -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

                    1 Reply Last reply
                    0
                    • J Jorgen Sigvardsson

                      Haha! I'll have to try that trick some day... ;D Another interesting trick would be to #define public private and see if the other programmers will figure out what the hell is wrong. Muhahah! I think I'll have some fun at work some day :) -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

                      L Offline
                      L Offline
                      loket
                      wrote on last edited by
                      #23

                      Or for some real fun #define ; // :-D /M


                      - Don't sweat the petty things, and don't pet the sweaty things.

                      J 1 Reply Last reply
                      0
                      • J Jorgen Sigvardsson

                        Christian Graus wrote: I hate typedefs, the place I see them most is used to obsfucate STL code Hoooooold your horses mate.

                        template <typename T, int SIZE>
                        class array {
                        T arr[SIZE];
                        /* more stuff here */
                        public:
                        typedef T* iterator;
                        typedef const T* const_iterator;

                        iterator begin(); 
                        iterator end();
                        /\* and some more stuff \*/
                        

                        };

                        also

                        class SomeClass {
                        typedef std::list<SomeType> SomeTypeContainer;
                        typedef SomeTypeList::iterator SomeTypeContainerIterator;

                        void SomeMethod() {
                             SomeTypeContainerIterator i = m\_list.begin(), end = m\_list.end();
                             //std::list<SomeType>::iterator i = m\_list.begin(), ... 
                             while(i != end) {
                                  // Do magic
                             }
                        }
                        

                        };

                        typedef hides implementation details, and it may save a lot of typing (ponder the case where you figure you want to replace std::list with std::vector for whatever reason. A lot less to change in the code if you typedef it). It's not all obfuscated. -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

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

                        Jörgen Sigvardsson wrote: It's not all obfuscated. when I said Jörgen Sigvardsson wrote: the place I see them most is used to obsfucate STL code I did not mean they were useles altogether, just that they get used to do more harm than good most of the time. I should have said I hate the misuse of typedefs, I did not mean to imply all typedef use is bad. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 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
                        • L loket

                          Or for some real fun #define ; // :-D /M


                          - Don't sweat the petty things, and don't pet the sweaty things.

                          J Offline
                          J Offline
                          Jorgen Sigvardsson
                          wrote on last edited by
                          #25

                          If you make a lot comments, then #define ; ;// would be ideal, wouldn't it? -- standing so tall, the ground behind no trespassers, on every floor a garden swing, and another door she makes it clear, that everything is hers A place of abode, not far from here, Ms. Van de Veer

                          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