Something is really wrong when a car company is beating tech companies to the punch with tech innovation.
299 karma · joined July 9, 2022
Something is really wrong when a car company is beating tech companies to the punch with tech innovation.
But this post is amazing and explains a pretty tricky concept, and history, of "subsystems" in a pretty easy way. Effectively, Kernel32(Now KernelBase) has the logic for usermode stuff, and goes into ntdll solely for syscall stubs. It then gently eases the idea of User32 having a similar purpose, as well as GDI. These are the 3 "subsystems" that interact with the Kernel, and it's a pretty core concept, but alot of newbies struggle to understand.
BOOL AddOverflowUnsigned(BYTE* a, BYTE* b, INT32 sizea, INT32 sizeb)
{
BOOL IsMsb = PlatformIsMSB();
BOOL IsLsb = PlatformIsLSB();
//log error
if(!IsMsb && !IsLsb)
return FALSE;
//Early out for overflow. Assuming
if(sizea == sizeb && PlatformIsMSB())
{
BOOL AMsb = (a >> ((sizea * PlatformByteSize()) - 1)) & 1;
BOOL BMsb = (b >> ((sizeb * PlatformByteSize()) - 1)) & 1;
if(AMSB && BMsb)
{
//We overflow, early out.
return FALSE;
}
else if(sizea == sizeb && PlatformIsLSB())
//Code here.
//We add using bitwise operators so we can do it on any size.
//SUM = A XOR B XOR CARRY, return in A
//Impliment algo here.
return TRUE;
}
int main()
{
UINT64 a = 69;
UINT64 b = 420;
if(sizeof(a) !
return AddOverflowUnsinged(&a, &b, sizeof(a), sizeof(b));
}
But they have this in the STD now and also all the secure coding libs have this in it's header as a basic function. There's also the easier implementation of just adding a check to see if it will overflow, rather than add in the function.You also only have a few you can hardcode if you don't do it generic, since all will go back to the primitives of uint8, uint16 ....
There's three big issues here.
A. It's arguable the actual impact humans have on climate change.
B. Even if A is true, then we stil have geopolitics since the technology isn't ready or mature enough for mass adoption, and when major polluters are massive ships and factories, it doesn't matter what you personally do. Not only that, but if on a nation level you do impliment these policies, you're giving up your own freedoms to another country like China who won't and WILL overtake you by having immense economic efficiencies since they use oil and just pollute. Then you end up in the same situation you were anyways, but now under a communist dictatorship where you can't complain, with no countries like Nato or anyone else to save you. Very dystopian.
C. Even if we do hit the end times with climate change, all the science points towards Geoseeding as being a solution way before that.
Sad to see it's just circle jerking of fake intellectuals going "YA BRO ANYONE WHO DOESN'T AGREE IS DUMB, UNEDUCATED" or "Being unable to do comprehensive reading and understanding basic physical processes is not a good starting points in 2023." - atoav , or "I've basically given up on anything drastic happening until the dipshit conservatives in the US stop their moronic crusade on this topic. I give my money monthly to a carbon sequestration company and mostly use my bike and mass transit, but offsets for flights." - Sporkland, truly the greatest sanitation engineers of our time.
What does change is the STL. Asking someone what a constructor is, or templates, or auto, or ConstExpr, ConstInit, ConstEval and the differences. It's the exact same code on any format or machine. Asking someone what a "Unique_ptr" or "Ranges" or whatever is a bit in the bullshit realm of an interview and should be shamed. But C++ is vastly seperated from the STL. And odds are in an interview, you can ask someone about their specific domain of c++ they use in most cases, since usually a win32 shop is going to interview win32 people.
mov rax, 1 ; load the value to exchange into rax
acquire_lock:
; attempt to acquire the lock
xchg byte [ADDR_LOCK], al ; atomically swap the lock value with rax
test al, al ; test if the original lock value was 0 (unlocked)
jnz acquire_lock ; if it was not, loop until we can acquire the lock
The downside is you want a backoff to sleep the thread so it doesn't go into a loop. But the actual lock code is simple. You can easily have this be your function "AcquireLock()" and then dowhile(!AcquireLock()) { //pause thread execution. }
And I think this is where they get the syscall being needed, since this will normally require a syscall to pause the thread from the scheduler.
The only time in my entire career i've ever used the STL was in college. Since most C++ jobs are not Appdevs. All those have moved to C#, Go, or some other higher level language. Or again, just rely on the built in suite like RTL, Posix, Unreal
Languages like Go are designed so that someone who's not familiar or wants to use these patterns can write safe and good code. And ALOT of people are complete idiots at c and c++ in a good fashion. You can see the most obvious and horrible programmers making critical things like routers who just have the most blatant bugs or bad practices. And what you don't know, you don't know. So these people exist in bliss pushing shitty horrible, bug ridden code. ANd using these coding styles which prevent that are extra tedious and annoying.
For libraries, try to use VCPKG to find and build new ones to statically link. You also need to learn about compiler definitions, like declspec. And need to worry about alignment on some things as well.
If you donate more to the NRA, they'll have more resources to defend the second amendment.