I'm pretty sure using a union is also undefined behaviour? I think it may depend on C vs C++. In C, it is not UB -- rather, it just produces a perhaps-partially-un specified result. However, from what I can tell it does guarantee that, if you are converting from type A to B and A 's "object re...

Thanks for the excellent advice! @EvanED: No, singles are fine. I avoided using f(x1) <= f(x2), because then f(x)=constant is technically a valid solution. I should have said "floating point" rather than "doubles"... point is, you're not working with ints or fixed point. (Both o...

To the rest of y'all, JS is a pretty decent language. ... As a heavy user of both JS and Python, the two are extremely similar . Guido, and hence Python, knows what a type error is. :-) (Yeah, I know I cut out the "if you enjoy languages without strict typing" part, but you can probably g...

Seemingly unpopular opinion: JavaScript has the cleanest type system of all dynamic languages. Prototype based inheritance just makes so much more sense for a dynamic language than classes. Ugh. I haven't used JS enough to have an opinion on the prototype system, but there is no way that, even if i...

Are you telling me that Notepad and Microsoft can be misleading? gasp :P So for what it's worth, I actually feel a bit of sympathy for MS on this one because of its history. Windows adopted Unicode very early, back when it was (I think... this is my impression, and I might be wrong) synonymous with...

I think I might have to work on my program's memory use. 353gb.png (You might think that this would be thrashing like crazy, but it was actually pretty well-behaved most of the time, as you can see from CPU% there. Though it is thrashing now as it's running destructors after program exit. I did have...

Are there that many non-toy applications that use graphs but do not need high performance OR specialized structures? First, I'm not sure there are "that many", but I personally fairly frequently do one thing or another on a reasonably small graph (hundreds to hundreds of thousands of node...

Graph data structures need to be tightly coupled to the problem they want to solve. Even something simple like DFS requires specialized data structures (i.e. a per-node flag that remembers if the node has already been visited yet). You wouldn't need to store that flag intrusively though. It might b...

I don't know why you're adding the check to the initialization of stuff. stuff can be empty without problems. The representative is the problem. Unless some information was lost in simplification/anonymization of the code, that's where the check belongs. It's interesting you say that; when I was or...

When linking to a compiled entity, you already need to find out or specificy its type, no? When adding exception inference to a language, the exception type will just have to be specified alongside the normal type. If you have to "specify" it, then it's not inferred. Or when it isn't, it ...

Hmm, I wonder whether exception inference can solve the symptoms of checked exceptions. If type inference can transform the monstrosity that is Java into C++'s auto/Scala/Haskell, then surely exception inference can hide that complexity. Every expression is just a monadic function (Right? Am I righ...

Baba Yaga is the epitome of a witch, and is pretty damn cool. She's basically a cranky old grandmother... a powerful witch with "Godfather" like connections across the world and spirit realms. And also the inspiration for maybe the best music of anyone mentioned in-thread. :-) (Harry Pott...

C++ allows both, although the C style declaration is really only used in forward declarations as far as I know. Sure, that's why struct S s; works. But struct S() to create a temporary doesn't, and that's really my complaint. It's not really a practical matter, but in the name of consistency I thin...

First, wrong forum. [not anymore -phlip] Second, I suspect it's so that people will get the latest version of the software instead of installing something old just so that it can then go and be updated. So it's sort of a security issue, in the sense that installing an old version is generally a secu...

redundant check for result.Rows.Count > 0 Why is that redundant? Is it not possible that result could exist but have zero rows? Yes, in which case the loop won't execute because of the test. But what if you omitted the test? Then the loop would execute zero times. Soooo... same thing! There's nothi...

The illogic of using the word "implies" and the distinction from the typical English meaning may become clear when I make the following statement: (A implies B) implies (B implies A). From an English standpoint, this statement is false. The fact that A implies B does not in any way imply ...

Not a shell thing per se, but you can combine the head and grep: sed -n '/foo/p; 10q' out.txt (sed -n /foo/p = grep foo . 10q = quit at line 10 = head .) Your point stands, though. It's hardly an improvement. And even more what I was trying to get at, if you're building up your pipeline incremental...

Depends what you call a "special" character, but: ... That's exactly what I came to the thread for. Thanks! The top one for me is... ------------------------------ ERROR OUTPUT ----------------------------------- Um, I suspect that was probably me pasting a file into the shell by accident...

Btw C already has a clean circuited implication that implicitly converts to bool: !a || b. I'm not sure I'd call that clean, especially if the "operands" to the implies start becoming complicated. Perhaps this is my fault, but if I see that I don't start thinking about what it means in te...

Of course mathematically there shouldn't be a difference, but this is about notation, and how to make due with limited formatting options. But the other part of notation is to have predictable rules that lead to everyone having the same unambiguous interpretation. I agree that 1/xy seems like it sh...

What's the warning message from GCC 6 anyway? It's an instance of -Wtautological-compare; it's some variation of "comparison is always false." I don't have access to the exact message ATM. Just for the record, I was slightly wrong; it's -Wbool-compare rather than -Wtautological-compare: $...

(And thank you to the C++ committee for allowing < and > on bool , though maybe I could by that was the least-terrible solution.) It's probably a side-effect rather than a solution: booleans may be implicitly promoted (note: not even converted in the case of an integer) to other types. Right, but t...

Late to the party, I know, but I got the GOTY edition of this a couple months ago and have been playing through. I'm not sure how far I am... probably 1/2-2/3 of the way through, at least trying to play pretty completeist. (I'm sure I'll miss a ton nevertheless.) And overall, it's a blast; I'm lovin...

"It requires a copy constructor" is definitely the bigger objection there by a significant margin, though I'd argue that the copy-elision "optimizations" are of a much different character than most, in that they can actually change the non-timing semantics of your program. (In th...

Maybe this is religious wars, but I'll put it here for now... Goddammit C++ can be a terrible language sometimes. Some of this anger is directed at the fact that we're not using C++11 for some reason, but most of it C++98/03 deserves. template<typename T> void foo() { // declare and value-initializ...

If you were limited to using a steering wheel and pedals for your spaceship control system, I hope you would have the sense to at least engineer in an "axis control" so that you could shift the abstracted "flat surface" on which your steering wheel would move you around. You mea...

Are there xattrs that store more than a few bytes of data? Otherwise a key-value based interface seems pretty okay to me. First, it depends what you mean. Fixed size, no, but limited to a small size is common but not universal. Plenty of systems have arbitrary-length xattrs, including, on paper, Re...