79634394

Date: 2025-05-22 19:16:19
Score: 0.5
Natty:
Report link

But then, in this tutorial on OOP in C, the examples seem to lack that struct, even if they don't use the typedef "trick".

Here is a sample of what is apparently intended to be C code from that web page:

struct Shape;
struct ShapeType; 

ShapeType* ShapeType__create(
…

Since the post is from 6 years ago, I was wondering if the C standard allowed that type of code, or maybe the author of the post is assuming some compilation flags or something else. Or is it just a typo?

No version of the C standard has provided that struct ShapeType would provide a type that could be used as ShapeType* ShapeType__create….

Reasons:
  • Blacklisted phrase (1): this tutorial
  • Blacklisted phrase (2): was wondering
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • High reputation (-2):
Posted by: Eric Postpischil