AlmightySnoo 🐢🇮🇱🇺🇦

Yoko, Shinobu ni, eto… 🤔

עַם יִשְׂרָאֵל חַי Slava Ukraini 🇺🇦 ❤️ 🇮🇱

  • 30 Posts
  • 46 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle




















  • I know the guy meant it as a joke but in my team I see the damage “academic” OOP/UML courses do to a programmer. In a library that’s supposed to be high-performance code in C++ and does stuff like solving certain PDEs and performing heavy Monte-Carlo simulations, the guys with OOP/UML background tend to abuse dynamic polymorphism (they put on a pikachu face when you show them that there’s also static polymorphism) and write a lot of bad code with lots of indirections and many of them aren’t aware of the fact that virtual functions and dynamic_cast’s have a price and an especially ugly one if you use them at every step of your iterative algorithm. They’re usually used to garbage collectors and when they switch to C++ they become paranoiac and abuse shared_ptr’s because it gives them peace of mind as the resource will be guaranteed to be freed when it’s not needed anymore and they don’t have to care about when that is the case, they obviously ignore that under the hood there are atomics when incrementing the ref counter (I removed the shared pointers of a dev who did this in our team and our code became twice as fast). Like the guy in the screenshot I certainly wouldn’t want to have someone in my team who was molded by Java and UML diagrams.







  • I’m not entirely sure what you mean by memory isolation here, but the basic idea is that if you have a pointer to something then you know where it is located in memory and you can write in it, that’s the whole idea of passing by address in C.

    Now pointers themselves are merely variables. Yes they have a special meaning, they “point” to something and you can dereference them with the * operator, but at the end of the day they’re still variables. They have a physical existence in memory or CPU registers, and their content is simply the address to which you want to point. Once you accept this, then the idea of the address of a pointer (ie the location of the variable you’re calling “pointer”, and not the address it contains) is not strange anymore and you can perfectly have a pointer-to-pointer in order to, among other things, pass pointers by address.