79153824

Date: 2024-11-03 23:12:33
Score: 0.5
Natty:
Report link

As you probably noticed C & C++ are different languages.

Is it possible to make it compile when included into C++ code without making the struct type declaration untested?

Yes it is:

#include <stdio.h>

struct foo {
    struct bar {
        int baz;
    } bar;
};

int main() {
    struct foo::bar a;  // Use foo::bar to refer to the nested struct
    a.baz = 2;
    printf("%d", a.baz);
    return 0;
}
Reasons:
  • Blacklisted phrase (1): Is it possible to
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-2):
Posted by: 0___________