slab: (Default)
2024-09-10 04:23 pm

fake integer types

In my last post I mentioned:
a lot of this was pre-<stdint.h> so the integer typedefs were u8/u16/u32 and i8/i16/i32. u64 and i64 were classes in some cases, which is probably a cursed-c++ post all of its own

... so here's that post. )
slab: (Default)
2024-09-09 09:38 pm

i can still hear you saying we would never break the chain

Every now and then I will read a paper or see a talk about error handling in C++, and often they will take one of two forms:
  • Use exceptions! Always use exceptions.
  • Never use exceptions! Return error codes instead. (If it's something sufficiently new, it might bring up std::expected.


I've yet to see anyone show up with an implementation of the C++ error propagation mechanism that was pervasive at my old workplace, so I will impart upon you the (possibly-cursed) knowledge of...

status chaining

okay, what )
slab: (Default)
2024-01-16 06:00 pm

the tale of the upgraded compiler and the corrupted memory

(I originally posted this over on cohost, but cohost will be shutting down so I'm reposting it here.)

While writing this comment I had a story from circa 2015 that didn't really fit in the comment so I figured I should instead branch it out into A Post because I don't really do enough of those here.

So, MSVC has a /kernel flag that it gained at some point (I want to say MSVC 12.0 or so, but Microsoft doesn't have the documentation online for anything earlier than MSVC 2015 anymore). This flag tells the compiler that you're building something to run in the Windows kernel. For C++, this also turns off exceptions and RTTI, so you're getting a subset of C++, but even a subset of C++ can be pretty useful.

There is also another thing that that flag does which is a bit more subtle.
Read more... )