title: Arrow Operator vs. Dot Operator
body: <p>It seems to me that C's arrow operator (->) is unnecessary. The dot operator (.) should be sufficient. Take the following code:</p>
  
  <pre><code>typedef struct {
      int member;
  } my_type;
  
  my_type   foo;
  my_type * bar;
  int       val;
  
  val = foo.member;
  val = bar-&gt;member;
  </code></pre>
  
  <p>We see that the arrow operator must be used to dereference bar. However, I would prefer to write</p>
  
  <pre><code>val = bar.member;
  </code></pre>
  
  <p>There is no ambiguity as to whether I am trying to pull 'member' from a structure or from a pointer to the structure. But it is easy to use the wrong operator, especially when refactoring code. (For example, maybe I am doing some complex operations on foo, so I move the code into a new function and pass a pointer to foo). I don't think I need to care whether foo is a pointer or not; the compiler can worry about the details.</p>
  
  <p>So the question: wouldn't it be simpler to eliminate -> from the C language?</p>