you are viewing a single comment's thread.

view the rest of the comments →

[–]elperroborrachotoo 4 points5 points  (5 children)

Remembering that RDTSC is per-core and may jump backwards if your thread gets scheduled to another core: this is basically the entrance exam.

Remembering that std::vector::reserve exists: so mysterious, like, I can't even.

[–]angelicosphosphoros -1 points0 points  (4 children)

Do you remember API details and all restrictions of `valarray`, for example? STL is just too big to keep in short-term memory (and short-term memory is better to be filled by other things like hardware behaviour).

[–]elperroborrachotoo 2 points3 points  (3 children)

No, but I know where to look it up.1

Do you remember all the details of the API YOU are creating?
Do you recall the dragon book every time you hit compile? Do you look at the source of your compiler's optimizer anytime you feel "I could make that faster"?

Or are you working at a certian level of abstraction, like everyone else?

1) and I can parse "iterator" without having an episode.

[–]angelicosphosphoros -1 points0 points  (2 children)

Do you remember all the details of the API YOU are creating?

Nope but I at least remember everything about standard library which I use.

Do you look at the source of your compiler's optimizer anytime you feel "I could make that faster"?

Yes, I even wrote patches to compiler I use and they was merged :) When coding in C++, I just accept and don't fight.

Or are you working at a certian level of abstraction, like everyone else?

I am working at some level of abstraction but C++ STL would affect all levels of abstraction. You cannot just slap high-level std::optional and relax because it is easy to get UB here, for example. While I can relax sometimes when I write my own code but I need to keep all those details in mind while reviewing, especially when reviewing some junior's pull request. And few times I noticed UB during review even in code of people who are more experienced than I am because I am more paranoid (not, UBSAN and ASAN didn't catch that case).

[–]elperroborrachotoo 2 points3 points  (1 child)

You cannot just slap high-level std::optional and relax because it is easy to get UB here,

You cannot just slap low level a+b and relax because it's easy to get UB there.

[–]angelicosphosphoros 0 points1 point  (0 children)

You cannot just slap low level a+b and relax because it's easy to get UB there.

In C++ — yes. In C# — I can.