Reputation
4,044
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
3 17 21
Newest
 Good Answer
Impact
~480k people reached

  • 0 posts edited
  • 0 helpful flags
  • 98 votes cast
Feb
4
comment std::shared_ptr as a last resort?
@BenVoigt: And what if it is simply returning a pointer rather than creating it? Furthermore, what if the guy getting that unique_ptr actually wanted a shared_ptr, because he needs to share ownership with others?
Feb
4
comment std::shared_ptr as a last resort?
@BenVoigt: I'm not talking about passing temporary pointer as a parameter during a function call. I'm talking about an object needing to store an object either temporarily or permanently (in a game scenario, imagine an AI that needs to retain a targeted entity over a period of time). Or a pointer returned from a function. There's no way to guarantee anything about either of those cases without some kind of managed structure like shared_ptr.
Feb
4
comment std::shared_ptr as a last resort?
@BenVoigt: Of course, the difficulty with passing around naked pointers is that you don't know the lifetime of objects. If some object holds onto a naked pointer and that object dies... oops. That's exactly the kind of thing shared_ptr and weak_ptr were designed to avoid. Bjarne tries to live in a world were everything has a nice, explicit lifetime, and everything's built around that. And if you can build that world, great. But that's not how it is in the real world. Objects need to ensure that the object lives through that object's life. Only shared_ptr can do that.
Feb
4
comment std::shared_ptr as a last resort?
Have you considered listening less to the advice presented and more to the argument behind that advice? He explains pretty well the kind of system in which this sort of advice would work.
Dec
28
comment Two HTML elements with same id attribute: How bad is it really?
@Andrea: The internet would not have grown as we know it. It would have grown more slowly. But it would also have had a more solid basis of what is and is not correct code. Fast-but-sloppy may work, but I much prefer slower-but-correct. Especially since it's not like we'd only be talking about a couple of years of growth or so.
Dec
21
comment Why is C++ known as 'premature optimizaton'?
[citation needed]
Dec
5
awarded  Nice Answer
Dec
5
answered Is `catch(…) { throw; }` a bad practice?
Sep
13
awarded  Nice Answer
Sep
12
answered Strictness in programming methods among Stack Overflow users
Sep
12
comment Why C++ cannot adopt D's approach for its concept implementation?
I agree with iammilind: it should be moved to Programmers. Though it would be nice if there was a bit less random boldface text needlessly emphasizing words that we don't need to have emphasized.
Aug
23
awarded  Necromancer
Aug
11
awarded  Quorum
Aug
5
answered Is information hiding more than a convention?
Jul
25
comment At what point is it good to try to reinvent a standard?
"Browsers are a good example of this." I fail to see how. They are all simply implementations of a standard. Different implementations will have different levels of conformance to that standard. But each browser itself is not a standard. You seem to be missing the difference between a standard and an implementation of that standard.
Jul
24
answered Is UTF-16 fixed-width or variable-width? Why doesn't UTF-8 have byte-order problem?
Jul
10
comment Options other than C for embedded projects? I hate the preprocessor
@michael: the preprocessor does do what it is supposed to do. It builds token lists for the C tokenizer. That's what it is for. Your problem is that it doesn't do things the way you think they should be done, based on a standard you have created yourself. Consider "import." You can't do that with a preprocessor; you need language-level support to make anything like that work in any way different from include. import is not a part of the preprocessor; it's a part of the compiler.
Jul
9
comment Options other than C for embedded projects? I hate the preprocessor
Michael, you're not going to get a lot of sympathy among programmers when you say that C isn't "modern enough." It's not supposed to be modern. C is what it is; you can either accept it for what it is or reject it. And don't think that eLua is going to save you; mobile platforms have rather low power CPUs, and even Lua's performance isn't going to be enough for anything serious with JIT compilation. Of course, there's LuaJIT, which compiles for ARM platforms...
Jul
3
comment Why do game developers prefer Windows?
@DMan: Cross-platform compatibility is pretty much the only real strength OpenGL has over D3D; in most other repsects, they're close enough to not matter much. Also, most of OpenGL's problems are in the past; the problem is that the past is often why people use something in the present. And that's what my article was showing: how screwups in the past influenced people to pick D3D.
Jul
2
comment Does over-reliance on tools imply that you are lazy?
@Skeith: Does a database user need to care about how to implement a database? Of course not; the database user uses it. They may need to know some of the details, so that they can optimize their databases, but they shouldn't have to be able to implement it in order to be worthy of using it. Also, a programmer may not know what the word "algorithm" means, but that doesn't mean they don't write them. I was developing and implementing algorithms long before I ever heard the term.