I know in C++ the struct
keyword can be safely omitted for structures, but I'm not sure if the same rule can be safely apply to the structures inherited from C headers. To be more specific, those structures form socket interface, e.g., sockaddr_in
, sockaddr_in6
...etc
So, can I safely omit struct
keyword for all the structures including those from C interfaces when I'm using C++?
I've done some searching on this one, but can't find any clear answer.
- Here is a similar question, but did not mention those old C structure Why does C need "struct" keyword and not C++?
- Another one here C++ struct keyword usage, but the question did not received a detailed or sure answer.
I did try to take out the struct
keyword from one of my C++ source and it compiled without any error. But I would like to know if it's safe in all cases.