Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, and there's another inconsistency here as well. Arrays and pointers into arrays are accessed with the same syntax:

  char a[3], *pa = a;
  ... a[0] ... pa[0] ...
In contrast, with a struct, you have to know which one you have and use the correct operator:

  struct { int x; } s, *ps = &s;
  ... s.x ... ps->x ...
To be consistent, they could either have made '.' work in both cases, or forced you to write things like '(*pa)[0]'.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: