A
arnuld
here is the code from section 2.5.1 from Stroustrup (Special Edition):
namespace Stack {
struct Rep; // definition of stack layout is elsewhere
typedef Rep& stack;
stack create(); // make a new stack
void destroy(stack s); // delete s
void push(stack s, char c); // push c onto s
char pop(stack s);
}
Later Stroustrup says: "the declaration /struct Rep;/ says that /Rep/
is the name of a type but it leaves the type to be defined later.
doesn't it say that /Rep/ is of type /struct/ like /x/ is of type /int/
in /int x/ (hence /Rep/ is not a type but just a defined variable like
/x/ ?
namespace Stack {
struct Rep; // definition of stack layout is elsewhere
typedef Rep& stack;
stack create(); // make a new stack
void destroy(stack s); // delete s
void push(stack s, char c); // push c onto s
char pop(stack s);
}
Later Stroustrup says: "the declaration /struct Rep;/ says that /Rep/
is the name of a type but it leaves the type to be defined later.
doesn't it say that /Rep/ is of type /struct/ like /x/ is of type /int/
in /int x/ (hence /Rep/ is not a type but just a defined variable like
/x/ ?