|
|
|
|
|
by belgesel
1872 days ago
|
|
Although I disagree with some part of the presenter's ideas. I learned struct initializers and _Generic keyword from the presentation. So that is a great win for me. Now I can write safer code with the const and non-const pointer types. Suppose that I want to return a pointer to a field inside of a struct. Either I had to write const and non-const versions of the same function and use them which brings unreadable code.
Or I would have to define argument as const and return non-const pointer which defeats the purpose of const in the first place. This keyword allows me to use same function name with const and non-const pointers. |
|