[cfe-commits] [PATCH] Re-enabled and fixed fixit for main returning non-int
Ryan Gerleve
aikavanak at gmail.com
Wed Mar 16 18:37:09 PDT 2011
I'll provide an updated patch soon, but one picky question about this
issue first: how should a 'signed' specifier be handled? Currently,
clang accepts these:
signed main() {}
signed int main() {}
I assume these are correct, because they are equivalent to 'int', but
I don't think the (C++) standard is specific about this. But what if
the program looked like this, for example:
signed long main() {}
Here, there are multiple fixits that could result in a correct program.
1. Remove 'long',
2. Replace 'long' with 'int', or
3. Replace 'signed long' with 'int'.
My instinct is that 3 is best, mainly because the error text currently
states that 'main' must return 'int', and it seems awkward to have a
fixit suggest text that differs from the error itself (which both 1
and 2 would do).
But I can also see value in a fixit that makes minimal changes to the
source. In that case, 2 seems best. The fixit would result in 'signed
int' while the error would say 'int', so perhaps it's worth changing
the error text to something like "'main' must return 'int' or
equivalent".
Since I'm still new at this, how are multiple potential fixits
generally handled?
More information about the cfe-commits
mailing list