3 ms·
The gotcha is that if in the same function you put in another URL with the same protocol, the compiler will refuse to compile the code due to a duplicate label.
by nayuki 6y ago
The gotcha is that if in the same function you put in another URL with the same protocol, the compiler will refuse to compile the code due to a duplicate label.
int main() {
https://acceptable/
http://okay/
https://duplicate.error/
}
- iforgotpassword 6y agoDue to a duplicate protocol
- klodolph 6y agoAnother gotcha is that a statement must follow. The following is an error: int main() { https://error/ int x = 3; }
- colejohnson66 6y agoWhy?
- eindiran 6y agoIn C, a label requires a statement[0] to come after it. A declaration in C is not a statement (though it is in C++). gcc for example gives the error "error: a label can only be part of a statement and a declaration is not a statement" for the code in OP's comment. g++ happily compiles it. See the first answer here: [1] [0] https://en.wikipedia.org/wiki/Statement_(computer_science) https://en.wikipedia.org/wiki/Statement_(computer_science) [1] https://stackoverflow.com/questions/49861965/declarations-definitions-as-statements-in-c-and-c https://stackoverflow.com/questions/49861965/declarations-de...
- tyingq 6y agoCapitalizing different parts of the scheme would give you some mileage. The standard allows for it.
- sgt 6y agoLuckily there are other protocols we can work with to bypass this limitation. int main() { gopher://myhost:151/hello.txt ftp://ftp.acc.umu.se/pub/netbsd ldap://yesherewego dav://getmyfiles }