Why does the snippet of code below produce an error?
int fun(auto int arg)
{
return 1;
}
If I use "register" in place of "auto", it works fine. Is there any reason behind this or is it just the way C standard is defined?
Why does the snippet of code below produce an error?
int fun(auto int arg)
{
return 1;
}
If I use "register" in place of "auto", it works fine. Is there any reason behind this or is it just the way C standard is defined?
Allowing register is likely an historical artifact from the times when compilers were not sophisticated enough to optimize register allocations as well or better than humans. Back then it was desirable to tell the compiler that a particular parameter should be passed in one of CPU's registers, not through a stack frame.
No other storage class specifier could possibly make sense here: you cannot pass parameters as extern or static, while auto would create confusion.