Thread: Reinventing the Wheel

  1. #31
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by samGwilliam View Post
    I didn't read a single line of that (and I'm not going to), but it's entertaining to see just how much I've gotten under your skin!!
    your loss, bro. You haven't "gotten under my skin", I was trying to help you. It's highly unlikely I'll ever have to deal with your code, so feel free to immerse yourself in all the misery of tracking down memory leaks and stack corruptions.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  2. #32
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I'd just use a bog-standard array, obviously.
    hmm... I am starting to suspect that you think that vectors are not standard. Although we often speak of the STL as if it were like the ATL, the truth is that the "Standard Template Library" really is standard, since it is incorporated into the C++ standard library. In fact, I understand that C++ strings were not from the STL to begin with. Therefore, you could just use a "bog-standard" std::string.

    But if a flexible, dynamic method of storage was really that important then I'd use a linked list.

    What of it?
    What if you need random access? What if you want a container of key/value pairs with faster than linear time search? I think that it is better to be flexible in your choice of container, hence choosing one that best fits your solution. An array (including vectors) is often a reasonable "default" choice.

    I didn't read a single line of that (and I'm not going to), but it's entertaining to see just how much I've gotten under your skin!!
    You can stop trolling now. If you have made up your mind and refuse to listen to reason, then say so. It is not necessary to scorn the effort taken by someone else to explain things to you. If you continue with such an attitude, then you can expect no help from the users of this message board.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #33
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I just don't like relying too much on other people's code.
    LOL... Be real - and stop joking...

    You do not mean - that in your everyday work you only use your own hand made OS with hand-made compiler? To be sure that your exe relies only on your own hand-made code?

    Please, please - leave your fantasies and come back to the real world.
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #34
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    The attitude of the fella isn't new. You see that everywhere and not just in C or C++ circles. Some people "say" (and say is the operative word) they don't use external libraries, standard libraries, other people's code, etc...

    It is always quiet entertaining to see these people complete lack of judgment and good reasoning. It is particularly entertaining to imagine these people having to face certain coding challenges like... oh... I don't know... having to handle complex mathematical operations without a math library, or coding their own lossless compression algorithm, or a regular expression parser... all just because they don't use other people's code.

    As you say, vart. It's a joke.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #35
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Quote Originally Posted by samGwilliam View Post
    I didn't read a single line of that (and I'm not going to), but it's entertaining to see just how much I've gotten under your skin!!
    This post is amazing.

    I don't like using libraries myself. I've always been fine using standard libraries, but I just didn't like learning the ins and outs of 3rd party libraries that always seemed much larger and more complex than what I was aiming at accomplishing.

    As time has gone on and I've been working on different projects, I've come to better appreciate libraries written for multiple platforms that tackle a good portion of what I want to do. Perhaps one reason is that I'm working on more and more larger projects than I have been in the past, although that's not saying much since I haven't really done much.

    If you can't take the opportunity to read other people's posts, or to realize the benefit of using other tried and tested code, then as ChaosEngine said, it is your loss. I'm not sure why you would take pleasure in throwing someone's explanation back in their face when, by all appearances that I can see, their intent was to help you.

  6. #36
    Massively Single Player AverageSoftware's Avatar
    Join Date
    May 2007
    Location
    Buffalo, NY
    Posts
    141
    Quote Originally Posted by samGwilliam View Post
    Not of chars. Clearly I wasn't reading the posts properly. I'd just use a bog-standard array, obviously.

    But if a flexible, dynamic method of storage was really that important then I'd use a linked list.

    What of it?
    If you need a concrete example, I work on a C++ program that was originally written circa 1995, and it's full of C strings.

    This week I converted a few text-intensive functions from character arrays to C++ strings. Removing all of the C string manipulation crap and over allocated buffers trimmed around 500 lines from the program, and has reclaimed several thousand bytes of stack space.

    I used to scorn C++ strings and containers too, but experiences like this were a hell of a wake-up call.
    There is no greater sign that a computing technology is worthless than the association of the word "solution" with it.

  7. #37
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    The line of thought that you two are discussing is "No one could possibly code this better than me!" It's arrogance more than anything else, and people realize that. As far as I can see there is no reason to drive home the point of someone else if it will fall upon deaf ears in the first place. Let Mr. William be crushed by a wall of code he so enjoys to retype, and retype, and type yet again. This discussion has been over since Chaos Engine stopped responding.

  8. #38
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You are right Citizen. To each his own (sp?)

    Going back on topic...

    Only now, after one year of first starting dabbling in C++, did I start to become interested on the inner workings of the STL. Not so much because I felt a need to understand it, but because of curiosity.

    Naturally, because my knowledge of C++ is still so limited, I'm only scratching the surface of what really means "understanding the inner workings of the STL". Nevertheless, the STL is proving to be an excellent learning tool in its own right and "reinventing the wheel" has been on my case a pure learning exercise. In fact, I dislike the term when applied here.

    I don't honestly think using arrays is reinventing the wheel. I would rather prefer to think in creating new laws that govern how the wheel turns. Because that's the only use I can think for them when we see what the STL already offers.

    What I'm feeling while I'm pretending to be a C++ programmer developing my own game is that arrays are far more common that what one is lead to believe by the literature warnings and advises on that matter. And this goes for other elements of the STL too like std::string. I feel the need to create new laws is very common.

    However, my knowledge is flawed by both the fact I still smell like milk when it comes to programming in C++ and because I'm led by several book authors to develop a non-healthy attitude towards not believing in their advise.

    When I'm told not to use exceptions when I can avoid it because of the tradeoff in speed and code size and leaves it at that, I have to ask "But what then when speed and size is not a problem, which is the case in most of the applications developed around the world?" The same applies to the STL in the sense that examples like the ones provided by Chaos are much more enlightening than simply advocating "don't do it because of [insert reasons here]" without also debating "When should you do what I'm telling you not to do"

    These reasons, my friends are obvious to you. You know your C++ well. But we don't. We still smell like milk. And being youngsters on the matter whe are particularly prone to a) make mistakes in the choices we do, b) only listen to bad advise and c) be religious about our believes.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reiventing the wheel (again)
    By Elysia in forum C++ Programming
    Replies: 5
    Last Post: 12-02-2007, 03:26 AM
  2. my mouse wheel
    By DavidP in forum Tech Board
    Replies: 0
    Last Post: 11-06-2006, 09:58 AM
  3. Problems with mouse wheel...
    By xkrja in forum Windows Programming
    Replies: 1
    Last Post: 09-12-2006, 02:22 PM
  4. Logitech MOMO wheel broke, fixed manually
    By Xei in forum Tech Board
    Replies: 2
    Last Post: 07-25-2003, 02:29 AM
  5. Mouse Wheel In Console
    By GaPe in forum C Programming
    Replies: 0
    Last Post: 09-07-2002, 02:05 AM