Re:How to write type-safe generics in C
by eptcyka on Saturday November 15, 2025 @10:48AM
(#45938165)
What would be the detrimental effect of using smart pointers?
Re:How to write type-safe generics in C
by flashgordon on Sunday November 16, 2025 @03:20PM
(#45948078)
Oh i didnt mean that smart pointers were bad or detriemental. Or even that any of the other gazzilion features of C++ were bad (or detrimental) on their own. Just that C++ has sooo many features that i dont think there is any one in the world who knows who any one feature X interacts with feature Y so your ability to reason about what you have written in C++ is significantly lowered.
If you can say I will only use features A, X an Z of C++ and some how enforce it then you are mitigating a lot of the risk. IIRC Carbon (Google's new lang to migrate their code off C++) came about because they themselves used C++ in a very bounded way (I recall a lot of the templates they created for their use of C++ actually resembled how Go code looked like and may have been one of the reasons for creating Go). But I am not sure how many mere mortals have that kind of tooling and discipline to limit themselves?
Re:How to write type-safe generics in C
by 1718627440 on Sunday November 16, 2025 @03:55PM
(#45948323)
Unclear, not explicit ownership.
The problems I am guessing start when you are tempted into using the rest of the features one by one. You have generics. Well next let's get inheritance in. Now a bit of operator overloading. Then dealing with all kinds of smart pointers...