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

  • 0 posts edited
  • 0 helpful flags
  • 98 votes cast
Feb
19
comment Why is it so difficult to make C less prone to buffer overflows?
It's still the responsibility of programmers to use the tools they have now to fix these problems. Take a half-day or so and do some grepping through the source code for these things.
Feb
19
comment Why is it so difficult to make C less prone to buffer overflows?
+1 for aiming the problem on the programmers, not the language.
Feb
17
comment Why are several popular programming languages influenced by C?
@DeadMG: But the question is about syntax. You can consider the syntactic similarities to be irrelevant, but the person asking the question wants to know why these irrelevant similarities exist.
Feb
12
awarded  Autobiographer
Feb
7
awarded  Nice Answer
Feb
7
awarded  Good Answer
Feb
7
awarded  Nice Answer
Feb
6
comment Is C++11 Uniform Initialization a replacement for the old style syntax?
@RobertDailey: "if you did int foo(10), would you not run into the same problem?" No. 10 is an integer literal, and an integer literal can never be a typename. The vexing parse comes from the fact that Bar() could be a typename or a temporary value. That's what creates the ambiguity for the compiler.
Feb
6
comment Is C++11 Uniform Initialization a replacement for the old style syntax?
@RobertDailey: They don't all turn into initializer list statements. as I said, the only reason vector<int> fails is because the type of the initializer list is int, which conflicts with the constructor that takes a single int. So it would only be a problem in those specific circumstances. And, as Xeo points out, you can easily use a simple placeholder object as a way of differentiating between those containers.
Feb
6
comment Is C++11 Uniform Initialization a replacement for the old style syntax?
@JohannesSchaub-litb: Fixed.
Feb
6
answered Is C++11 Uniform Initialization a replacement for the old style syntax?
Feb
6
comment Is C++11 Uniform Initialization a replacement for the old style syntax?
This might be a subject better discussed on Programmers.se. It seems to lean towards the Good Subjective side.
Feb
5
comment std::shared_ptr as a last resort?
let us continue this discussion in chat
Feb
4
comment Is there any reason why most programming languages don't have '!>' (not greater than) and '!<' (not less than) operators?
@hammar: True, but that's true of all arithmetic relations around NaNs. All of them stop behaving normally.
Feb
4
comment std::shared_ptr as a last resort?
I don't understand what you're talking about. The entity is "the class". Each entity is an object. How these are stored in some entity manager changes nothing about how they talk to and reference each other.
Feb
4
comment std::shared_ptr as a last resort?
Here's a very simple example. You have a game entity, which is an object. It needs to refer to another object, which is a target entity it needs to talk to. However, targets can change. Targets can die at various points. And the entity needs to be able to handle these circumstances. Your rigid no-pointers approach can't handle even something as simple as changing targets, let alone the target dying.
Feb
4
awarded  Critic
Feb
4
comment std::shared_ptr as a last resort?
"Passing ownership from factory to user code should be avoided." And what happens when that isn't possible? "Use of references instead of pointers or shared_ptrs." Um, no. Pointers can be reseated. References cannot. This forces construction-time restrictions on what is stored in a class. That's not practical for a lot of things. Your solution seems to be very rigid and inflexible to the needs of a more fluid interface and use pattern.
Feb
4
answered std::shared_ptr as a last resort?
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?