URL in C (2011)
(susam.net)92 points by birdculture 6 days ago
92 points by birdculture 6 days ago
It's not as needed in C given that you can use #if 1
It is handy in C derivatives, though.
I do this to embed shell commands at the beginning of short one-file C/C++ programs to execute when hitting an F key in my text editor. I usually put very basic compile-and-run commands. It's wrapped in #if and #endif which are comments in many shells. I end the commands with exit so it doesn't try to execute the code as commands.
Wouldn't there be a warning about an unused goto label
I wouldn't be surprised if a fair majority of them have been taught to see goto as nothing but a vestige of the 70s which should never be used under any circumstances except as a meme or to deliberately obfuscate code.
I have recently become quite fond of goto-based error handling and find it a lot cleaner and more readable than the if-else-mountains you otherwise end up with. I just make sure to leave a comment with a link to xkcd.com/292 so anyone else reading it knows I'm aware of what I'm doing. Now with this URL trick I can do both in one line. :)
Of all the (ahem, not as many as hoped) things C++ got right, // comments are one of the best ones
And I'm glad it now is part of C as well
This is why you should only use /* */ as your comment style.
Quite a time ago, my colleague accidentally committed a Youtube url to our Java codebase (middle-click accidental paste, no code review at that time). We had some laughing moments when we discovered it, as it was compelling evidence that he was watching videos during work, and even we knew what he was watching at that time.