rust-lang / book

The Rust Programming Language

Home Page:https://doc.rust-lang.org/book/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False statement about The C Programming Language

maxmosk opened this issue · comments

URL to the section(s) of the book with this problem:

> In C and C++, two different operators are used for calling methods: you use

Description of the problem:
There are no any methods in C, -> and . both can be used only for fields access.
Suggested fix:
Write True about this language. I can fix it.

While it is technically true that C does not have methods, you can absolutely store a function pointer on a struct in C and then call it using -> access. (There is a reason for C++’s use of that exact syntax. 😉) Closing this as the point here is not pedantic precision about C and C++ but rather getting the point across about how Rust differs from them. Thanks, though!