logoalt Hacker News

jstimpflelast Sunday at 7:42 PM2 repliesview on HN

I've argued elsewhere some things that are wrong with RAII and C++ objects in general.

Here I would just like to mention that if you have to rely on "de-virtualization" passes, you're in a miserable situation architecturally. If you have code where the overhead of virtual function calls might be too much to pay, don't do virtual functions then. End of story.

To deconstruct a pool of objects, I don't see what should ever be wrong with a function pointer. The overhead of loading the function pointer will get divided by the number of objects being deconstructed. Care to explain what's the issue here?


Replies

hugmynutuslast Sunday at 8:09 PM

> I don't see what should ever be wrong with a function pointer. [...]Care to explain what's the issue here?

1. You're writing code you don't have to

2. That adds runtime overhead

3. That when you screw up has non-trivial security & resource management side effects

This is objectively indefeasible in nearly any vaguely professional context.

show 1 reply
CyberDildonicstoday at 2:31 PM

I've argued elsewhere some things that are wrong with RAII and C++ objects in general.

You claimed there were problems many times for sure, I don't think you came up with any evidence of those problems.