WTF Bites


  • BINNED

    @Zecc said in WTF Bites:

    bash.org

    Things that remind you of WDTWTF members:

    I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet



  • @Zecc said in WTF Bites:

    @cvi bash.org #6460 is :arrows:

    LTFY.


  • BINNED

    Error in ClangCodeModelServer::requestReferences: Document '/path/to/foo.cpp' does not exist!

    Liar! ls says it does!

    Lately I've been feeling like I caught the @Tsaukpaetra curse or something. Why the fuck can't anything just work once in a while?



  • @topspin The compiler flags passed to the analyser probably got desynchronized from what gets passed to the actual compilation. Unfortunately this stuff is rather difficult to debug.

    I currently have an abomination in my hands: the project is split to zillion components and can only be built under ptxdist (or yocto/bitbake). Which means there is a contorted script that links the work directory into the ptxdist (or yocto) work directory and runs the build there. I've patched running bear into ptxdist, but then I had to write a script to translate the paths to what is seen from the checkout. And to top it off, the older version of bear, 2.3.11 (just installing the package from Bionic Beaver), detects multiple compiler invocations, one with and one without some important flags, because of how ptxdist uses compiler wrapper to inject those compiler flags (the newer version would only detect the wrapper and need configuration to detect the real compiler instead). The language server was acting up pretty weird before I found out and filtered them in the script.



  • @Bulb said in WTF Bites:

    @topspin The compiler flags passed to the analyser probably got desynchronized from what gets passed to the actual compilation. Unfortunately this stuff is rather difficult to debug.

    I currently have an abomination in my hands: the project is split to zillion components and can only be built under ptxdist (or yocto/bitbake). Which means there is a contorted script that links the work directory into the ptxdist (or yocto) work directory and runs the build there. I've patched running bear into ptxdist, but then I had to write a script to translate the paths to what is seen from the checkout. And to top it off, the older version of bear, 2.3.11 (just installing the package from Bionic Beaver), detects multiple compiler invocations, one with and one without some important flags, because of how ptxdist uses compiler wrapper to inject those compiler flags (the newer version would only detect the wrapper and need configuration to detect the real compiler instead). The language server was acting up pretty weird before I found out and filtered them in the script.

    Is this the cricket thread? :tro-pop: I'm sure those are real words, and most of them I understand. Just not put together like that.


  • Discourse touched me in a no-no place

    @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread?

    No. If it was talking about slips and deep square leg, then it might be the cricket thread. Or the NSFW thread. Hard to tell.


  • BINNED

    @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread? I'm sure those are real words, and most of them I understand. Just not put together like that.

    This is the wrong thread to mention how I misread "bitbake".
    And no, this is not Freudian in any sense that I'd want to read it that way.

    I can't help but think of How I Met Your Mother when I read "Bionic Beaver" though. :giggity:



  • @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread? :tro-pop: I'm sure those are real words, and most of them I understand. Just not put together like that.

    You sound like you never had the pleasure to meet a properly fucked C++ build system. Or any C++ build system, because most of them are fucked pretty hard.

    @topspin said in WTF Bites:

    I can't help but think of How I Met Your Mother when I read "Bionic Beaver" though. :giggity:

    Blame Mr. Shuttleworth for those names.



  • @Bulb said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread? :tro-pop: I'm sure those are real words, and most of them I understand. Just not put together like that.

    You sound like you never had the pleasure to meet a properly fucked C++ build system. Or any C++ build system, because most of them are fucked pretty hard.

    I've managed to stay a C++ virgin. And hope to stay that way. I'd take perl and PHP any day over C++.


  • Considered Harmful

    @Benjamin-Hall said in WTF Bites:

    @Bulb said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread? :tro-pop: I'm sure those are real words, and most of them I understand. Just not put together like that.

    You sound like you never had the pleasure to meet a properly fucked C++ build system. Or any C++ build system, because most of them are fucked pretty hard.

    I've managed to stay a C++ virgin. And hope to stay that way. I'd take perl and PHP any day over C++.

    You need to do some C to learn why not to.



  • 039d918f-70dd-4e55-8f58-5b3775e4eaf8-image.png

    Filed under: No, I did not. :-(


  • Banned

    @cvi a C++ file edited in terminal-based text editor (presumably Vim) by someone used to capitalized logic constants (presumably Python developer)? I don't want to be judgemental, but I have a very hard time not being judgemental.



  • @dkf said in WTF Bites:

    it might be the cricket thread. Or the NSFWL thread. Hard to tell.

    🔧 Cricket is unsafe for more than just work.



  • @Benjamin-Hall said in WTF Bites:

    I've managed to stay a C++ virgin. And hope to stay that way.

    Most of my C++ experience is just "C with classes", so I have only minor trauma.


  • BINNED

    @cvi said in WTF Bites:

    039d918f-70dd-4e55-8f58-5b3775e4eaf8-image.png

    Filed under: No, I did not. :-(

    Ah yes, because "free" is the alternative with the shortest edit distance. :rolleyes:

    Hey, at least I'm not the only one with broken-ass tooling.

    Filed under: hyphen


  • Banned

    @HardwareGeek said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    I've managed to stay a C++ virgin. And hope to stay that way.

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    C itself is traumatic enough.



  • @Gąska I've been doing C for ... 37 years. The scars are deep, so deep it's impossible to tell what's scar tissue and what's normal, if there's any normal left.


  • Java Dev

    @Gąska said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    I've managed to stay a C++ virgin. And hope to stay that way.

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    C itself is traumatic enough.

    If I move away from C at my current employer then it will certainly be into Java, and recently they've actually been pushing me into that direction. I've been pushing back because I'm fine where I am thankyouverymuch.



  • @Gąska said in WTF Bites:

    a C++ file edited in terminal-based text editor (presumably Vim) by someone used to capitalized logic constants (presumably Python developer)? I don't want to be judgemental, but I have a very hard time not being judgemental.

    You can stop being judgemental, since the uppercasing of True was a typo (the previous input was '(', which is shift-8 here, so shift was still engaged). The typo is why it's suggesting a fix. Of course, it would be more useful if the suggested fix were true, but what do I know.

    I don't Python, and I resent being thought of doing Python. In fact, such slander calls for that machine that can stab people over the internet.

    Also, I'm running gvim, so technically it's not in a terminal. Take that.



  • @HardwareGeek said in WTF Bites:

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    I mostly work with C++, and I can only say that I thank the existence of Stockholm syndrome every day.


  • Banned

    @cvi said in WTF Bites:

    Also, I'm running gvim, so technically it's not in a terminal. Take that.

    All the Vim's problems with none of its benefits!



  • @cvi said in WTF Bites:

    039d918f-70dd-4e55-8f58-5b3775e4eaf8-image.png

    Upon further reflection, the suggestion isn't all bad, actually.

    free, as in the identifier for standard function free() that frees memory, decays into a non-null function pointer value (=truthy), so it can be implicitly converted into the boolean argument that the function in question was expecting.

    🤔



  • @cvi said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    I mostly work with C++, and I can only say that I thank the existence of Stockholm syndrome every day.

    Also, I'm getting close to retirement, so this is good. (I changed companies because the last one wanted to convert me to Javascript! I ran screaming!)


  • Considered Harmful

    @cvi said in WTF Bites:

    @cvi said in WTF Bites:

    039d918f-70dd-4e55-8f58-5b3775e4eaf8-image.png

    Upon further reflection, the suggestion isn't all bad, actually.

    free, as in the identifier for standard function free() that frees memory, decays into a non-null function pointer value (=truthy), so it can be implicitly converted into the boolean argument that the function in question was expecting.

    🤔

    And hey, something could probably use freeing.


  • Notification Spam Recipient

    @Parody said in WTF Bites:

    Enter Windows NT/2000's Services for Macintosh. Our users started reporting a weird bug where our program would sometimes try to open random files from their Windows-based file server when they opened a document on their Mac. As it turns out, Services for Macintosh's file sharing didn't guarantee those unique ID numbers would never change for a given file, even when it hadn't been moved/renamed/changed.

    Yeah I could have sworn that's still the default, file ids are sequential in the order they're requested. I think. Have to wireshark the protocol I guess to see.


  • BINNED

    @cvi said in WTF Bites:

    You can stop being judgemental

    YMBNH



  • @HardwareGeek said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    I've managed to stay a C++ virgin. And hope to stay that way.

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    C with classes is the worst. In modern C++ you at least get something useful for all the extra complexity, but C with classes is mostly just a lot of syntactic vinegar.


  • Notification Spam Recipient

    @Bulb said in WTF Bites:

    @HardwareGeek said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    I've managed to stay a C++ virgin. And hope to stay that way.

    Most of my C++ experience is just "C with classes", so I have only minor trauma.

    C with classes is the worst. In modern C++ you at least get something useful for all the extra complexity, but C with classes is mostly just a lot of syntactic vinegar.

    All the better to catch flies with!



  • @Tsaukpaetra That only catches fruit flies and those are mostly harmless, while not helping against the flesh flies at all.


  • Discourse touched me in a no-no place

    @Bulb said in WTF Bites:

    C with classes is the worst.

    It's one of the sane subsets. The problem with C++ is that there's several sane subsets and they're madder than a sack of stoats when used together. Oh, and people disagree massively on which subsets should be used, so codebases inevitably evolve towards insanity.



  • @dkf I wouldn't say it is about subsets of the language but rather about the design styles. C++ is very flexible, so you can design your application in many different ways. And mixing those is the path to madness. Arguably it does not help that the standard C++ library isn't fully consistent itself (with streams being especially egregious showcase of antipatterns).


  • Considered Harmful

    @topspin said in WTF Bites:

    This is the wrong thread to mention how I misread "bitbake".
    And no, this is not Freudian in any sense that I'd want to read it that way.

    That's mojibake due to endinanness issues, isn't it?


  • Considered Harmful

    @Gribnit said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    @Bulb said in WTF Bites:

    @Benjamin-Hall said in WTF Bites:

    Is this the cricket thread? :tro-pop: I'm sure those are real words, and most of them I understand. Just not put together like that.

    You sound like you never had the pleasure to meet a properly fucked C++ build system. Or any C++ build system, because most of them are fucked pretty hard.

    I've managed to stay a C++ virgin. And hope to stay that way. I'd take perl and PHP any day over C++.

    You need to do some C to learn why not to.

    Perl and C go well together.


  • ♿ (Parody)

    TIL: Java doesn't throw an exception for integer overflow.

    EDIT: moved - meant to post here, not Windows 10


  • Considered Harmful

    @boomzilla said in WTF is happening with Windows 10? And nothing else:

    TIL: Java doesn't throw an exception for integer overflow.

    Why the hell would you want that? It would screw up most to all crypto and other seminumerical algorithms.


  • ♿ (Parody)

    @Gribnit said in WTF Bites:

    @boomzilla said in WTF is happening with Windows 10? And nothing else:

    TIL: Java doesn't throw an exception for integer overflow.

    Why the hell would you want that? It would screw up most to all crypto and other seminumerical algorithms.

    Would it?

    In any case, it would have revealed the bug I just fixed (which has been around for several months).


  • Considered Harmful

    @boomzilla well, at least that's not probably old enough for it to've had babies.



  • I would absolutely expect an exception for accidental integer overflow, and if you're writing some algorithm that is deliberately using it, for there to be a construction like C#'s unchecked { ... } that allows you to turn it off.



  • @boomzilla said in WTF Bites:

    Java doesn't throw an exception for integer overflow.

    Also C# fails, unless you explicitly tell the compiler to check that. Well, you gain a very little performance. And all (stupid) performance tests run algorithms which are a little faster when you ignore the overflow check... WTF.
    See also:


  • Banned

    @BernieTheBernie normally I'd point out that overflow checking can easily decrease performance by an order of magnitude - but it's C# we're talking about, and I have first-hand experience in how incredibly slow C# is when you use LINQ, structures and other standard features that you see everywhere.



  • @Gąska said in WTF Bites:

    when you use LINQ, structures

    Exactly: the performance penalty lies else where. The costs of overflow checking are nothing in comparison to that.


  • Considered Harmful

    @BernieTheBernie said in WTF Bites:

    @Gąska said in WTF Bites:

    when you use LINQ, structures

    Exactly: the performance penalty lies else where. The costs of overflow checking are nothing in comparison to that.

    For most programs. Overflow is rare, and reasonably predictable. Random number generation, hashing, nearly all crypto, depend on silent overflows. This is one of the cases where even Java said "put on your big boy pants" - and they check each array access.



  • @Gąska said in WTF Bites:

    overflow checking can easily decrease performance by an order of magnitude

    :sideways_owl: In every CPU architecture I can recall working on, certainly in X86 and compatible, the hardware sets or clears an overflow bit when it detects integer overflow. Checking that is literally a single branch instruction at the hardware level. Sure, what you do if you take the overflow branch may be slow, but at that point you're already in exception-handling, not the happy path.


  • Banned

    @HardwareGeek checking the overflow bits screws with OoOE and branch prediction, not to mention the compiler's output itself is much more verbose because the overflows have to be handled somehow. And I'm sure it makes a few compiler-level optimizations impossible too.

    Performance is complicated.



  • @Gąska said in WTF Bites:

    checking the overflow bits screws with OoOE and branch prediction

    Optimize for the normal path, and let exception-handling performance suck, because it will anyway. But I'll admit I don't know much about how the hardware does branch prediction (CPU architectures, at least non-trivial ones, are outside my hardware wheelhouse). Are there ways the compiler can tell the hardware which path to predict?


  • BINNED

    @HardwareGeek said in WTF Bites:

    @Gąska said in WTF Bites:

    overflow checking can easily decrease performance by an order of magnitude

    :sideways_owl: In every CPU architecture I can recall working on, certainly in X86 and compatible, the hardware sets or clears an overflow bit when it detects integer overflow. Checking that is literally a single branch instruction at the hardware level.

    But you have to test it after every single arithmetic instruction, or it gets cleared again. That’s a lot of branches everywhere.

    @Gribnit said in WTF Bites:

    Random number generation, hashing, nearly all crypto, depend on silent overflows. This is one of the cases where even Java said "put on your big boy pants" - and they check each array access.

    There’s a huge semantic difference between “silent overflow” and working in modular arithmetic.


  • BINNED

    @HardwareGeek said in WTF Bites:

    Are there ways the compiler can tell the hardware which path to predict?

    There’s branch hints on x64 AFAIR.


  • Banned

    @HardwareGeek said in WTF Bites:

    Are there ways the compiler can tell the hardware which path to predict?

    Yes and no, it's complicated, YMMV, IANAL etc. Like everything else in IT world.

    But I think branch prediction isn't as much of an issue as OoOE. If you don't check status flags, you don't have to save status flags for reference later. When you start checking, the CPU now has to remember the status after OoO instruction so it can be checked on a branch instruction. I'm not well versed in modern CPU architecture, but one thing is for sure - there is limited memory available for saving those flags, so code without checks can execute more instructions out of order than code with checks,

    Another thing is code size, and with that, cache utilization. If your code is larger, you're going to cache-miss more, and that can lead to significant performance penalties.



  • @Gąska said in WTF Bites:

    If your code is larger, you're going to cache-miss more

    This is 2021. HelloWorld.exe is 10GB, anyway. :half-trolleybus-br:


  • Considered Harmful

    @HardwareGeek said in WTF Bites:

    @Gąska said in WTF Bites:

    If your code is larger, you're going to cache-miss more

    This is 2021. HelloWorld.exe is 10GB, anyway. :half-trolleybus-br:

    Still there exist cache-aware or cache-friendly approaches for performance critical applications. You may have mistaken the movement in a backwater for the movement of the market.


Log in to reply