Open
Description
Bugzilla Link | 48273 |
Version | 11.0 |
OS | Linux |
CC | @zygoloid |
Extended Description
Consider this C function:
void transpose(double (*)[*], int);
void transpose(array, size)
int size;
double (*array)[size];
{
for (int i=1; i<size; i++)
{
for (int j=0; j<i; j++)
{
double t = array[i][j];
array[i][j] = array[j][i];
array[j][i] = t;
}
}
}
It uses a K&R function definition, which is deprecated and will probably be removed in C2x. To my knowledge, there's no standard replacement for that since the VLA comes before its size, but a GNU extension allows forward declaring parameters, like this:
void transpose(double (*)[*], int);
void transpose(int size; double (*array)[size], int size)
{
for (int i=1; i<size; i++)
{
for (int j=0; j<i; j++)
{
double t = array[i][j];
array[i][j] = array[j][i];
array[j][i] = t;
}
}
}
Today, GCC will accept that code, but Clang will not. Can support for that GNU extension be added to Clang as well?
Metadata
Metadata
Assignees
Labels
Issues migrated from bugzillaIssues migrated from bugzillaLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"Improving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature