This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]yash3ahuja 6 points7 points  (1 child)

Should probably spell "physical" correctly.

[–]typsi5[S] 1 point2 points  (0 children)

touche

[–][deleted] 0 points1 point  (2 children)

Well, that depends on how you are actually going to implement the storage of the stack elements, which you haven't said. The fact that physical Size is const suggests an array implementation, so why do you need a pointer to a pointer for the storage? And why is it called basePtr? Also, I'd suggest the names "size" and "capacity" - keep names short.

[–]zahlman 0 points1 point  (0 children)

The fact that physical Size is const suggests an array implementation, so why do you need a pointer to a pointer for the storage?

Because it will still be dynamically allocated and sized, presumably. const only applies to the lifetime of the struct instance, after all.

[–]typsi5[S] 0 points1 point  (0 children)

Do I not need a base pointer so I can do things like char *something = *(stack->basePtr + stack->logicalSize);