3,619 reputation
21832
bio website
location
age
visits member for 4 years, 3 months
seen 15 hours ago

Dec
5
awarded  Mortarboard
Dec
5
awarded  Enlightened
Dec
5
awarded  Guru
Dec
5
awarded  Nice Answer
Dec
5
awarded  Good Answer
Dec
5
comment Is `catch(…) { throw; }` a bad practice?
@SteveJessop: I was just saying that fault blocks are also a special kind of exception handler in the .NET framework. I wasn't saying that catch/throw was a Microsoft thing.
Dec
5
comment Is `catch(…) { throw; }` a bad practice?
Fun fact -- that block of code shouldn't even be considered a catch block, but a fault block -- a block that is executed only on an exception, which is part of Microsoft's .NET Framework.
Dec
5
comment Is `catch(…) { throw; }` a bad practice?
@MichaelKrelin-hacker: That too. Also, add to it the fact that they deprecated exception specifications because listing all possible exceptions in the code tended to cause bugs later on... it's the worst idea ever.
Dec
5
answered Is `catch(…) { throw; }` a bad practice?
Dec
3
comment What does C++ do better than D?
@PeterAlexander: In C++ I would just allocate it on the stack: MyClass s;, I don't see why you think we need placement new. And I do it very often (don't you??); it's not "rare" at all. In D I used to be able to say scope auto foo = new MyClass();, but since they removed it (probably because they don't want us to use it!) now I have to use emplace, which is painful. So effectively, D doesn't let you do what C++ does: to allocate an object on the stack. It's quite a fair comparison, and C++ does vastly better than in this regard. There's nothing "out of proportion" here.
Dec
3
comment What does C++ do better than D?
@PeterAlexander: You must be joking, right? How do I access the caller's stack frame and allocate data on it?
Dec
3
comment What does C++ do better than D?
@PeterAlexander: Yes, the exact problem with emplace is that it requires a ridiculous amount of typing to do something so simple -- first I have to declare a ubyte buffer, then I have to do sizeof on the type (which may need something like typeof(foo).sizeof) to get the size of the buffer, then I need to emplace it (God knows the hell I'd go through if the type had alignment > 16 bytes). So while it works in theory, in practice it's been made to prevent people from actually using it, given how painful it is to use. It's nothing like in C++.
Dec
3
comment What does C++ do better than D?
@PeterAlexander: Yes, let's be clear indeed -- I'm talking about DeadMG's last comment: I should waste the overhead of dynamically allocating it and the indirection and cache and collection overheads because I want to alias it? I was saying that forcing the user to use reference types creates a performance penalty due to the heap allocation, whereas pointers to structs don't have that penalty because the struct can be allocated on the stack. This is clearly something that C++ does better than D (even better since it allows value type inheritance), as it provides more control/performance.
Dec
3
answered What does C++ do better than D?
Dec
3
comment What does C++ do better than D?
@PeterAlexander: DeadMG is right on the point. "You shouldn't use pointers to value types" is clearly ignorant of the fact that pointers in any language are generally used with value types (do you really expect to see an Object* as widely used as an int*?) and D seems to be completely ignoring the performance penalty, or claiming it doesn't exist. That's obviously false -- the cache miss is quite noticeable in many cases, so C++ will always have that flexibility advantage over D.
Nov
12
accepted Reason behind multi-line declaration style?
Nov
12
accepted Why were short, int, and long invented in C?
Nov
2
comment What programming language is most suitable for handling unstructured data?
Whoa, what's this note on the bottom?
Oct
31
comment Why was the C syntax for arrays, pointers, and functions designed this way?
@Caleb: Funny how you concluded that so easily, because I learned it and I still had this question...
Oct
31
accepted Why was the C syntax for arrays, pointers, and functions designed this way?