Scope Resolution and this statement

In a class (C ++) that I took recently, a teacher noted that using a statement ->was a bit slower than using dot notation and dereferencing your pointer manually (e.g. (*ptr)).

  • Is that true, and if so, why?
  • Does this also apply to C?
+4
source share
1 answer

The operator ->does not work slower or faster than the operator .. The fact is that dereferencing of something happens more slowly than just access to memory, because there is one more indirectness. And this is a fact of life, both in C and C ++, and in any other language.

++ , -, . ! , -vs-dot, , .

+6

Source: https://habr.com/ru/post/1608782/


All Articles