2

(A similar question about godbolt links in posts, rather than comments, was posted a few hours after this.)


So, on C and C++ tagged questions, it is common to link to the online compiler at http://gcc.godbolt.org/.

However, as of today, SO is blocking me from providing such links. A sample link has the form http://goo.gl/XheF1S .

But trying to put this in a comment, I get a big blurb that url-shortened links may not be used, with a link to this meta thread.

However, the full form of the URL, which is http://gcc.godbolt.org/#%7B%22version%22%3A3%2C%22filterAsm%22%3A%7B%22labels%22%3Atrue%2C%22directives%22%3Atrue%2C%22commentOnly%22%3Atrue%2C%22intel%22%3Atrue%7D%2C%22compilers%22%3A%5B%7B%22sourcez%22%3A%22MQSwdgxgNgrgJgUwAQB4DOAXOID2A6ACwD4AoEgNxxDiQDMAKcDJAQwG1MWMQIkAmALpsAzAICUJAN4kks2jgBOSRmGYgkAXiQAGANxJ1KfvoDUJkBNlX5SlcwBWmnfsdHhpk%2FctWrABwVMDABEAKRwADpgQQA0rGwgQvbiuiQAvmRMSAC2LOD0EtJWmewAjEKiKdb0LGKVSDKymQBGIuUCdXT0TbVpQAAA%3D%22%2C%22compiler%22%3A%22g520%22%2C%22options%22%3A%22-pedantic%20-O3%20-Wall%20-std%3Dc11%20-x%20c%20-pedantic%22%7D%5D%7D , is too long to fit in a comment.

So this change has made it unable to link to examples in comments, which is very annoying.

I appreciate the intent in blocking url shorteners but in this case it has interfered with the Q/A process. Examples in comments are commonly used in order to provide clarification, or when debating how the answer should be improved.

For now I am working around it by mangling the url a bit and hoping the reader can figure it out, but that is going to make it more difficult for OP to see the example.

Would it be possible to undo this change for C and C++ questions, or white-list gcc.godbolt.org, or something?

10
  • 9
    I hope not. Users link to this site instead of providing working code; and that's frustrating to everyone when the link goes down or the code there changes. Mar 23, 2016 at 1:08
  • 3
    @GeorgeStocker the code is contained in the full form of URL , so it cannot change
    – M.M
    Mar 23, 2016 at 1:20
  • 1
    "instead of providing working code" - the primary purpose of this site is to show the compiler output for a given piece of code
    – M.M
    Mar 23, 2016 at 1:21
  • 2
    Proposal: SE create their own link shortener service (just like SE's own imgur) that can be used by 1k+ rep users.
    – Andrew T.
    Mar 23, 2016 at 2:03
  • 12
    or white-list gcc.godbolt.org But you're not linking to that site. You're linking to "goo.gl" There's no way to know where any such link actually points to. That's the whole point of a link shortener. And this isn't a new policy; link shorteners have always been disallowed, it just seems that the one you use finally got added to the blacklist.
    – Servy
    Mar 23, 2016 at 2:04
  • " There's no way to know where any such link actually points to." - follow the link and you will see. The point of the shortener is to not have so many characters in the link; not as an obfuscatory measure. Either way, this change just makes it more difficult for users of the site .
    – M.M
    Mar 23, 2016 at 2:16
  • 2
    "So, on C and C++ tagged questions, it is common to link to the online compiler at gcc.godbolt.org." It's wrong to call it "common". It certainly has been used and does get favored by some people. But there are many online compilers in common usage in the C++ tag. Personally, I hesitate to use any online compiler link that puts the actual code itself in the link. Mar 23, 2016 at 3:08
  • 3
    @NicolBolas I hesitate to use one that doesn't have the code in the link, because it may become invalid over time
    – M.M
    Mar 23, 2016 at 3:11
  • 2
    @M.M: And how would dumping database entries be any different than Godbolt changing their URL encoding scheme? Any off-site resource is vulnerable to link rot. At least with normal online compilers, you aren't required to use a URL shortener just to be able to pass the link around reasonable. Mar 23, 2016 at 3:13
  • 1
    One suggestion has been to use gists as the backend to storing the code. We've of course replaced one single-point-of-failure (goo.gl) with another (github) though. Feature request tracked at: github.com/mattgodbolt/gcc-explorer/issues/19 Mar 23, 2016 at 12:52

2 Answers 2

12

Could we allow long URLs inside [text](url) constructs inside comments by not counting the URL length against the 600 char limit?

Keeping comments short is probably mostly aimed at preventing them from taking up too much space on the page. URL characters are not part of the rendered comment.


Shog9's suggested workaround of leaving edits is just not appropriate in all cases. It's better than nothing, and maybe actually better than a comment in some cases, but definitely worse than just leaving godbolt links in comments in other cases, even when it is at all viable.

2
7

The root problem here is that comment length limits are just too restrictive. Not just for C - comments are irritatingly restrictive for code in many languages.

Fortunately, questions and answers allow up to 30,000 characters, leaving ample room for not just code but also error messages and explanations.

As a bonus, such posts are automatically indexed for search, and record a handy list of revisions when edited. And anyone can edit at any time, unlike comments which are locked down after a few minutes.

9
  • 4
    Are you suggesting editing discussion into someone else's answer? (For example the case came up today: Person A posted an answer, Person B posted a comment to the answer saying "that's no good because compiler will do bla bla", and I went to respond to Person B saying "actually it won't, here is an example". But I could not link the example. What should happen in this case?
    – M.M
    Mar 23, 2016 at 2:18
  • 1
    Put a link to the example in the answer then?
    – Shog9
    Mar 23, 2016 at 2:20
  • 1
    That would make the answer worse though. I think most people consider it bad etiquette to edit somebody else's answer not long after they post it (except to fix typoes) -- especially if the edit contains information not directly related to the answer?
    – M.M
    Mar 23, 2016 at 2:21
  • 4
    @M.M I think such an edit would improve the answer; just phrase it as a "You might think that... but instead..." rather than a reply to the comment. (On the other hand, I'm not editing this comment into Shog's answer, so...) Mar 23, 2016 at 2:43
  • 1
    @JeffreyBosboom OK I'll try that next time. IMHO conciseness is an important part of a good answer, it can be more confusing than illuminating to have an answer also include opinionated discussion of why various other possible solutions are not as good as the main suggestion in the answer. But it seems I'm in the minority here!
    – M.M
    Mar 23, 2016 at 2:52
  • 2
    @M.M. Person B's comment is evidence that the answer was too concise for at least one person. There's nothing wrong with a concise answer, followed by a horizontal rule and a longer explanation. Mar 23, 2016 at 3:08
  • 1
    @JeffreyBosboom and Shog9: editing the post you're commenting on isn't always appropriate at all. Sometimes I guess it could work even if it's worse than leaving a godbolt link in a comment would have been. I posted an answer with a different solution: don't count URL lengths as part of the comment limit. Mar 23, 2016 at 6:10
  • 1
    Here's an example of a case where I wanted to leave a godbolt comment to demonstrate why the answer was wrong. Editing it into the answer was very clunky and pretty much inappropriate, and I only did it because the answer has so little value that it will probably just get deleted. This is pretty horrible. Mar 24, 2016 at 6:21
  • 2
    @Shog9 Let me phrase it another way: If a user with 50 to 1999 rep suggests an edit to an answer that adds a godbolt link for the sole reason of referring to the link in a comment, how likely is the edit to be accepted? Should edit reasons for such suggested edits end with "for comment, per Shog9's suggestion at meta.stackoverflow.com/a/319541/2738262 "? Mar 24, 2016 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .