3 ms·
Have you only tested syntactically valid code? For example, the code snippet: for (int i = 0; i ? N; ++i) { a[i]->val = i; } Is clearly either C or C+
by scott_s 10y ago
Have you only tested syntactically valid code? For example, the code snippet:
for (int i = 0; i ? N; ++i) {
a[i]->val = i;
}
Is clearly either C or C++, but it's not valid C or C++ because "i ? N" is not a valid boolean expression in the for loop. I actually think your techniques would work on syntactically invalid code, but I'm curious if you tried.
- pprogrammer 10y agoProbably almost all of the samples are syntactically valid, but it probably works OK for invalid code. Adding or removing symbols can have an impact on the results though, as those may occur more frequently in other languages.
- ZanyProgrammer 10y agoMaybe not valid C code, depending on what version, because of the int in the loop?