Slashdot Mirror


User: NFLFan

NFLFan's activity in the archive.

Stories
0
Comments
7
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 7

  1. Re:Features I want... on Stroustrup on the Future of C++ · · Score: 1
    You have me scratching my head here. I call constructors all the time without using new. Whenever I call delete the objects destructor gets invoked too! I don't understand your need for passing parameters to delete, but you can to destructors and don't forget classes hold state!
    Ugh, just realized that you were talking about placement. Still, something does not sound right. Anyhow, placement should almost never be used and one should spend more time justifying its use than on implementation details.
  2. Re:Syntactic candy. on Stroustrup on the Future of C++ · · Score: 2, Insightful
    # Some cases where you can type ; where previously {} was necessary, saving as many as two keystrokes. # The lexer ambiguity where a> and a > meant entirely different things is fixed, saving as many as one keystroke.
    I don't think it is about saving one from typing but preventing errors. An expierenced C++-er knows to avoid >> with templates but does a beginner? The error messages can be less than great with templates- so avoiding one is all the better. The error message that g++ now seems to give is helpful but so annoying saying something like "you used >> where you wanted > > ... [c++ template garble]."
    EVEN MORE "free" constructors which may or may not work quite the way you wanted them to in practice.
    That sounds like a very ignorant argument. I used this constructor but it does not do what I want it to, is it wrong?
    More "fancy cast" operators, which sounds nice until you remember that if there's ever a time you find yourself using the C++ "fancy cast" operators, then there is a damn good chance that it's because you're doing something unwise enough it really would be a better idea to refactor the code to make the "fancy cast" unnecessary.
    I assume the current fancy C++ cast operators you are talking about are static_cast and dynamic_cast. With the lack of multi-methods and it being an error to downcast an object c-style I think the need for static_cast and dynamic_cast are clear. The only good clue to maybe needing to refactor an hierarchy is when it is unsafe to use static_cast in place of dynamic_cast (when you know the type), times when you have virtual base classes and other goofy instances.
  3. Re:Features I want... on Stroustrup on the Future of C++ · · Score: 1
    1. Member function pointers. Implementation dependent and messy syntax that few people even know about. Their use is limited, and they don't support delegates like C#, making them ugly to work with.
    Okay, member functions pointers are implementation dependent but the syntax is not- lets not murky the waters. 2. The "virtual =0" syntax instead of something nice like "abstract" or "interface" is just weird. How can you set a prototype equal to 0? What's wrong with nice words? Oh well, deal with it. I certainly would not want the notion of interfaces that Java has and have to concern myself with using implents or extends to inherit a class, yuck.
    3. Operator new and delete were designed by someone on crack. The only way to call a constructor is with placement new, whose syntax looks like: new (var) type(). Placement delete, however, doesn't call the destructor, which must be invoked manually. Furthermore, delete can't take parameters like new. What.
    You have me scratching my head here. I call constructors all the time without using new. Whenever I call delete the objects destructor gets invoked too! I don't understand your need for passing parameters to delete, but you can to destructors and don't forget classes hold state!
    4. There is a "typeid" operator but no "typeof" operator. GCC has an extension for this, but it's not standard C++ I think.
    Okay, so there is no typeof. You can get a lot of its functionality out of sizeof though! See Modern C++ Design pages 34-37 for details. I believe there is also a good chance of it getting added, that is why they make admend standards afterall.
  4. Re:Yeah about that standard library... on Stroustrup on the Future of C++ · · Score: 1

    Speaking for myself, I find the STL a lot more useable than Java's standard library. Java's library is umm just too big for me and does not fit together that well. Countless times in Java have I picked/used a class that I later determined needed changed in favor of a similar class with more functionality. There also seems to be a lot more ughly method calls in Java- like obj1.fn(obj2.fn1().fn2().fn3()). And then there is the fact that the STL is faster and the retaining of types seem to allow for more.

  5. Re:*yeah* initializing std::vectors on Stroustrup on the Future of C++ · · Score: 1

    Well buddy, there are ways to initialize vectors! To initialize a vector<int> of size 100 to the number 9 you would do "vector<int>(100, 9)" but beware if you expand the vector afterwards the new elements are not initialized to your desired value. The vector function resize does take an optional second argument to initial new elemetns, otherwise it falls back to the default constructor. If you want to initialize the vector later, perhaps because you do not know the size until later, use assign such as "vector<int> v; ...; v.assign(100, 9);"

  6. The Art of Computer Programming on Is Programming Art? · · Score: 1

    Donald Knuth named his books which study algorithms in great detail The Art of Computer Programming. So even though I usually want to sway to the other side I would say programming is an art!

  7. Re:Good primer on aspect-oriented programming? on Aspect-Oriented Programming Considered Harmful · · Score: 1

    Surprised no one has suggested AspectJ yet. You can find it a http://eclipse.org/aspectj/.