2,443 reputation
2618
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 11 months
seen 4 hours ago

Mar
21
comment Why have hardware-accelerated vector graphics not taken off?
Not entirely sure what you want, but what about Cairo, Mozilla Azure, and Direct2D?
Mar
21
comment Are generic programming and OOP mutually exclusive?
@RobertHarvey The main difference between a generic in the C# sense and a template in the C++ sense is that a C# generic binds to interfaces and does overload resolution using the abstract type parameter whereas C++ binds to names and does overload resolution with the concrete type at instantiation time.
Mar
21
comment What is a good design for a container, assignment and items
I'd give Flight a property Bookings and a property Users, where Users is a convenience feature. I'd mostly abandon the notion of Container and Assignment, but if you really want you can use interfaces(IContainer with property IEnumerable<IAssignment> Assignments to represent them.
Mar
21
comment Do unit tests sometimes break encapsulation?
@MattFenwick It might be a sign that they should be moved to a different class, but that class should probably be internal, so you still end up testing internals.
Mar
21
comment What's your favorite bit-wise technique?
I've seen MS C++ output similar code for a division by a constant. Division is slow on some CPUs (even x86) compared to a multiplication and some bit operations. Essentially it multiplied by 2^32/c, took the high 32 bits, and then applied some extra operations to handle the corner cases.
Mar
18
comment Writing an API that is syntactically valid in multiple programming languages
IMO it's more important to follow platform conventions than having an identical API. Having a similar API is probably a good idea, an identical API probably not.
Mar
17
awarded  Populist
Mar
17
comment strategies for dealing with machine epsilon
Use a different type that represents numbers as fractions. Then you can represent all rational numbers exactly.
Mar
16
comment Is using `continue`, `break` in non-`switch` loops and `?:` bad practice?
break and continue are fine when used in moderation. ?: is a matter of style. I dislike it, but it's not necessarily bad.
Mar
14
comment Do You Still Need Indexing After Database Normalization
The index on the primary key doesn't count?
Mar
14
comment UTF-16 Pitfalls, Chinese
Only use UTF-8 when working with string and char. Use UTF-8 for output. The only unusual problem is that UCS-2 != UTF-16, since Chinese has some codepoints that require two code-units (i.e. one codepoint that consists of two chars)
Mar
14
revised How to make .exe file from html5 css application?
dressed links, fixed grammar
Mar
14
suggested suggested edit on How to make .exe file from html5 css application?
Mar
13
comment Performance and other issues with using floating point types in C++
@Sjoerd Your claim might have been true in the age of x87. But I doubt that's true anymore thanks to SSE (and similar SIMD instruction sets). I believe SSE can work on twice as many 32 bit floats at the same time, so I'd expect an approximate factor 2 speedup with 32 bit floats over doubles if the algorithm can be parallelized. But modern CPUs are complex, a lot depends on the specific situation.
Mar
12
comment Is Non-Deterministic Resource-Management a Leaky Abstraction?
"If you make a subtype that doesn't require special destruction" That's not a LSP violation, since no-op is a valid special case of destruction. The problem is when you add the destruction requirement to a derived class.
Mar
12
comment Is Non-Deterministic Resource-Management a Leaky Abstraction?
With refcounting you need to be careful about avoiding circles. So that abstraction leaks as well, just in a different way.
Mar
12
comment How do I know if I have a good programming professor?
How do you define "good"? Learning a lot? Getting good grades? Having fun?
Mar
11
awarded  Great Answer
Mar
11
awarded  Good Answer
Mar
11
awarded  Mortarboard