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. The best refactoring I have ever seen

The best refactoring I have ever seen

Scheduled Pinned Locked Moved The Weird and The Wonderful
c++visual-studiocomjsoncode-review
5 Posts 5 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.
  • M Offline
    M Offline
    matt_taws
    wrote on last edited by
    #1

    Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime. I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:

    #undef GetTickCount
    #define GetTickCount timeGetTime

    Sad thing is, he doesn't take criticism well.

    S J P R 4 Replies Last reply
    0
    • M matt_taws

      Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime. I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:

      #undef GetTickCount
      #define GetTickCount timeGetTime

      Sad thing is, he doesn't take criticism well.

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      Stop being such a bore! Don't criticize, teach! ^^

      My programming get away... The Blog... Taking over the world since 1371!

      1 Reply Last reply
      0
      • M matt_taws

        Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime. I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:

        #undef GetTickCount
        #define GetTickCount timeGetTime

        Sad thing is, he doesn't take criticism well.

        J Offline
        J Offline
        Jonathan C Dickinson
        wrote on last edited by
        #3

        Even though it hurts my eyes a little, I must say that it does demonstrate some prettydamn good knowledge about how the C/++ compiler goes about things. At least it didn't go into stdafx.h.

        He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb] Jonathan C Dickinson (C# Software Engineer)

        1 Reply Last reply
        0
        • M matt_taws

          Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime. I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:

          #undef GetTickCount
          #define GetTickCount timeGetTime

          Sad thing is, he doesn't take criticism well.

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Oh indeed, put it in a header file; not the code files. Code files should contain very few directives.

          1 Reply Last reply
          0
          • M matt_taws

            Apparently, one of my co-workers found out that the GetTickCount function from the Windows API isn't reliable as it seemed in the first time he used it. The solution, obviously, was to refactor our code base to use a more reliable function, like timeGetTime. I almost cried when I saw his commit changing a bunch of *.cpp files, with the following code in the beginning of every file:

            #undef GetTickCount
            #define GetTickCount timeGetTime

            Sad thing is, he doesn't take criticism well.

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

            I think you'll find the technical term is refuctoring.

            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