Why does the following code compile? Which section of the language allows URLs to be added in C and C++ code?
int main()
{
http://www.stackoverflow.com
return 0;
}
Thanks in advance, Castro.
If you compiled with warnings, you would notice:
warning: label ‘http’ defined but not used
That should be indicative enough of the problem here.
The http:
text is treated as a label.
Followed by //
negating the remaining text as a comment, ignoring it.
http://www.stackoverflow.com
Even the SO syntax colour schemes indicated as above show this to be true, as the section after the http, is treated as a comment (grayed out).