3 ms·
I found another difference between C and C++ recently. C++ compiles the code in the following post ok, but C doesn't. https://old.reddit.com/r/C_Programming/co
by tapirl 7y ago
I found another difference between C and C++ recently. C++ compiles the code in the following post ok, but C doesn't.
https://old.reddit.com/r/C_Programming/comments/bn04w0/confusion_on_array_parameters/ https://old.reddit.com/r/C_Programming/comments/bn04w0/confu...
In short, for "typedef struct bar bar;", C views "bar" as an incomplete type, but C++ doesn't.
- dearrifling 7y agoThat doesn't sound right. I think the difference is that C++ doesn't treat that as an array declaration so it doesn't require a complete type.
- tapirl 7y agoWhat is the root cause for the difference?