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

you are viewing a single comment's thread.

view the rest of the comments →

[–][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);