Skip to main content
4 events
when toggle format what by license comment
Jan 30, 2022 at 17:17 comment added Steve Note also that access operators are fundamentally concerned with calculating relative memory offsets for sequentially stored fields. Natively there are only memory indexes. Array access allows memory offsets to be calculated by field index. Structures allow memory offsets to be calculated by field name, and with regard to the memory length of anterior fields (of varying type) in the same structure. Dereferencing pointers is a different concept entirely, not at all involving offsets calculable at compile time, but moving to a memory index determined at run time. (2/2)
Jan 30, 2022 at 17:16 comment added Steve "The critical thing here is that these two operations are not the same." - I think that is indeed the critical point. The syntax is different because they are fundamentally different operators. The dot operator could as easily be used for array access too - as array.0 or array.i instead of array[0] and array[i] - but in the days before IDEs, the distinction in operator syntax indicated the intended operator and argument type explicitly, and overloading operators according to argument type (even if feasible) would have been less clear for human readers and prone to subtle errors.(1/2)
Dec 15, 2020 at 20:00 history edited user3840170 CC BY-SA 4.0
archive.org link
Apr 26, 2019 at 15:54 history answered DrSheldon CC BY-SA 4.0