News for hackers. Stuff that matters.
Re:Stop writing classes... by tptacek on Saturday March 17, 2012 @10:57PM (#3718961)
I'm reminded of 100 horrible C APIs that take a "struct foo_opts" instead of just conceding that they need 7 or 8 silly arguments.

Or of "sockaddr_in".

Re:Stop writing classes... by barrkel on Saturday March 17, 2012 @11:49PM (#3719040)
The sockets API would be much more future proof if C better supported polymorphism. That's usually the reason for using structs instead of arguments; in Windows, most API structs start with the size of the struct, effectively indicating the version. Makes binary compatibility easier when you add arguments in version n+1.

sockaddr_in is the way it is because of sockaddr, sockaddr_in6 etc. Judicious polymorphism could have led to fewer headaches converting IPv4 apps to IPv6.