(const char*) PushBack generation error
Closed this issue · 1 comments
thradams commented
This code:
struct StrArray
{
const char* /*auto*/ * /*auto [Size]*/ data;
int Size;
int Capacity;
};
void StrArray_PushBack(struct StrArray* p, const char* s) /*default*/;
is generating:
void StrArray_PushBack(struct StrArray* p, const char* s) /*default*/
{
if (p->Size + 1 > p->Capacity)
{
int n = p->Capacity * 2;
if (n == 0)
{
n = 1;
}
constchar** pnew = p->data;
pnew = (constchar**)realloc(pnew, n * sizeof(constchar*));
if (pnew)
{
p->data = pnew;
p->Capacity = n;
}
}
p->data[p->Size] = s;
p->Size++;
}
The problem is constchar instead of const char.
thradams commented
The problem was the cannonical print of the type.