|
|
|
|
|
by tialaramex
1779 days ago
|
|
Hmm. How do C++ namespaces help with the structure naming problem in this example? They seem completely orthogonal. C++ namespaces are a way to avoid library A's symbol "cow" clashing with library B's symbol "cow" without everything being named library_a_cow and library_b_cow all over the place which is annoying. I agree C would be nicer with such a namespace feature. However this technique is about what happens when you realise your structure members x and y should be inside a sub-structure position, and you want both: d = calculate_distance(s.x, s.y); // Old code and d = calculate_distance(s.position.x, s.position.y); // New ... to work while you transition to this naming. |
|
https://www.foonathan.net/2018/11/inline-namespaces/