I\'ve always been a little confused about what\'s going on here:
#include
int main() {
timeval tv;
tv.tv_sec = 1;
for (;;) {
Syntactically both treat struct
almost the same. Only C++ has added an extra rule that allows to omit the struct
(and class
) keyword if there is no ambiguity.
If there is ambiguity, also C++ requires the struct
keyword in some places. A notorious example is stat
on POSIX systems where there is a struct stat
and a function stat
.