Hacker News new | past | comments | ask | show | jobs | submit login

> - Why A.B()? Period gets read as a sentence terminator and that function is being called with no parameters, which makes no sense.

What C syntax is this referring to?




You can do that, with a structure and a function pointer.

  struct a {
    void (*B)();
  }

  struct a A = { .B = ... };
  A.B();


Great example, especially considering op found that he added that example as a mistake :D


I severely overloaded a reference to C-family syntax and should have provided multiple examples instead. I erred, by trying to avoid C, C++, Java etc. specific comparisons.

What I should have written:

- Why is "Foo()" a function is being called with no parameters, which makes no sense.

- What is "A.B" Period gets read as a sentence terminator. I learned C++ and Java very early on in life and had never considered A.B to be an issue.


I think the only "hard" part about the syntax of C are pointers. Reading e.g. i++ *a->b[0]




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

Search: