71

I was answering a question where the OP stated their code does not work as intended. I checked and found that from my reading of the C++ standard, the code should work and the OP is therefore encountering a compiler bug (nonconformance). I answered to this effect, quoting the relevant part of the standard.

The OP was using a compiler other than GCC, and I tested that their code works just fine with the GCC on Ideone. I wanted to add a link to that code on Ideone to have them see for themselves that it works. I could not, because "links to Ideone have to be accompanied by code, etc., etc."

There is no code I could reasonably put in my answer (no need for it, to be exact).

I understand the ban on codeless Ideone links is there to prevent answers like this:

Here's how you fix your issue: [link to Ideone].

Still, I believe my case above is not the only time when a code-free answer could benefit from such a link. I would therefore like to ask for a way to circumvent the blanket ban. I wouldn't mind it being a privilege (tied to e.g. a relevant tag badge or reputation). My point is: if the site generally claims it trusts a user to know what they're doing (by giving them e.g. edit & mod-tool privileges and/or a dupe-hammer), shouldn't that extend to turning "you can't post a codeless link" into "you're posting a codeless link, please click here to indicate you really intend that?"

16
  • 22
    A c++ gold badge should suffice I'd say :)
    – Bart
    Jan 23, 2015 at 9:56
  • 1
    Could you post without and then edit the link in? Jan 23, 2015 at 10:21
  • 2
    @Deduplicator Doesn't work. I actually didn't have it in the first version and only tried to add it in an edit - still prohibited. Jan 23, 2015 at 10:25
  • 7
    Following this ban logic we should ban also links to jsfiddle because I've seen a few questions containing just link with no code (in times when we have built-in, several times misused code snippets), so jsfiddle is allowed in no-code posts as it seems.
    – TLama
    Jan 23, 2015 at 11:35
  • 6
    @Bart I think tying it to rep makes a lot more sense. The question is, "Do we trust this user to create quality content?" Presumably, a reasonably high rep user is trusted to do so, irrespective of their expertise in the subject matter. A language specific tag badge would be more relevant to the question, "Does this user understand the subject matter?"
    – jpmc26
    Jan 23, 2015 at 11:40
  • 1
    Do not answer as it will be of no value. Add a comment below the question containing the link. If necessary, vote to close the question with appropriate reason.
    – Salman A
    Jan 23, 2015 at 11:59
  • 21
    @SalmanA The OP asks "What am I doing wrong." How does "nothing, it's a compiler bug" have no value?? Jan 23, 2015 at 12:00
  • 2
    Fairly questionable whether a link that shows that the code works is going to be useful. Clearly the OP came here because it didn't work. Jan 23, 2015 at 16:13
  • 15
    @HansPassant It shows that it works in a different compiler. It is used as support for the statement "based on this and that section of the standard, the code should work." But you're right that wasn't clear from my question here, edited. Jan 23, 2015 at 16:16
  • 2
    There are other reasons to have no-code links too. In my case I tried adding a link to demonstrate the effect I called out in my answer, but of course I couldn't post it. I added the code to the answer, even though it doesn't add to the answer at all and is really just noise. I remember when StackOverflow started and the goal was to remove as much noise as possible, it seems that goal is obsolete now. Jan 23, 2015 at 16:33
  • 3
    P.S. When did this "feature" get added? This is the first time I've run into it. Jan 23, 2015 at 16:34
  • @MarkRansom I don't know when it started, but I remember having run into it a few times already. Jan 23, 2015 at 16:37
  • 2
    Hmm, guess I never ran into it because I always link to coliru.
    – T.C.
    Jan 24, 2015 at 4:18
  • @T.C.: Has content on coliru been in the habit of disappearing?
    – Ben Voigt
    Jan 24, 2015 at 17:59
  • 1

5 Answers 5

24

You shouldn't make a link to ideone.com a non-redundant part of your answer. The test is oriented around the code, while in your case it was the output you were referring to, but you need to put that directly in your answer to avoid dead links.

ideone.com is especially pernicious in this regard since their publicly stated policy has been to keep content "forever" but they actually have removed a lot of content linked to from Stack Overflow.

If the linked content is so unimportant as not to be a loss if the link breaks, post it as a comment to your own answer.

20
  • 8
    Basically, I said in the answer "It's a bug of your compiler because of X, Y and Z. When using GCC, your [code works]", where "[code works]" was the link. So the important information stays there even if the link breaks. Still, it seems rather pointless to me to offload that link to a comment. Jan 23, 2015 at 19:19
  • 19
    @Angew: Considering that the link is not under your control and can break at anytime, I think a comment "You can see it working on GCC here (link)" is perfect.
    – Ben Voigt
    Jan 23, 2015 at 19:21
  • @Angew: I think that your answer would have been more robust if you had written something like: "When using GCC, your code works. You can verify that by [running your code on Ideone]." But anyway, this doesn't solve your original problem.
    – honk
    Jan 24, 2015 at 8:30
  • 2
    @Angew: To rephrase this answer, you should pad your answer with a redundant code block, some compiler output, and a little extra fluff in between to make it sound like an answer. I guess you could also take a screenshot of some text constituting a link to an ideone page and require the asker to type the link in himself.
    – tmyklebu
    Jan 24, 2015 at 17:49
  • 3
    @BenVoigt: But comments are ephemeral. They get deleted and so forth. You're not supposed to answer questions in comments, and making an answer that hinges on text in a comment seems just as bad.
    – tmyklebu
    Jan 24, 2015 at 17:51
  • 1
    @tmyklebu: Links to ideone are ephemeral. Making an answer that hinges on an ideone link will get it deleted as a link-only answer. That's why you should put the content in a link, in a comment, only if it's unimportant. And stop putting words in my mouth, your paraphrase is completely wrong. Please delete it and repost without the claim that it is equivalent to my answer.
    – Ben Voigt
    Jan 24, 2015 at 17:56
  • 6
    All links are ephemeral, but we don't require other supporting links to be posted in comments instead of in the answer directly. It's possible to have an answer which is improved by the ideone link but doesn't hinge on it, but in those cases, you have to go through this weird circumvention process. Jan 24, 2015 at 18:58
  • @ChrisHayes: And if there's an example where there is a complete answer and a supporting link can't be added, I'll throw my support to revising the validation rule. But I suspect the validation rule already permits "(comprehensive explanation) + (no code) + (link)". The case mentioned here seems to be "(very short explanation relying on link)" and that goes bad when the link breaks.
    – Ben Voigt
    Jan 24, 2015 at 19:01
  • 1
    @BenVoigt My answer says "From my reading of the standard, the code should work. Follows a quote of the relevant part of the standard. When compiled with GCC, your code works, which [you can see for yourself on Ideone]." Does that feel like an answer that hinges on the link? I originally wanted to avoid the meta effect, but it seems you're imagining the answer different than it really is. Jan 24, 2015 at 20:24
  • @Angew: Yes, that definitely is not a link-only answer. Upvoted, and my suggestion is to end the answer with "GCC 4.9 accepts this code without complaint." with no link, then drop the link in a comment "You can see it working in GCC (here on the ideone.com online compiler)". That way a broken link won't detract from your answer in any way. (Also consider using coliru or rextester for such demos, since historical evidence is that they're less likely to break the link.)
    – Ben Voigt
    Jan 24, 2015 at 20:45
  • 1
    I still can't see much difference between the typical "Your problem is X and Y because of Z. Here's a correct code solution [Live example]" and this case. I'd say the link is equally supplemental. BTW, I didn't know Ideone was more volatile than coliru, I will keep that in mind. Thanks for the tip. Jan 24, 2015 at 20:58
  • @BenVoigt: "You shouldn't make a link to ideone.com a non-redundant part of your answer" is what I paraphrased. As far as I can tell, I paraphrased the meaning perfectly. If my paraphrase is completely wrong, then your answer is completely wrong; I see no reason to delete the comment.
    – tmyklebu
    Jan 24, 2015 at 21:27
  • 1
    @tmyklebu: Yes, exactly. That does not make the code block in the answer redundant, it makes the link redundant (but still worthwhile because of its convenience factor).
    – Ben Voigt
    Jan 25, 2015 at 1:41
  • 1
    Could you show me some examples of when Ideone deleted code linked from SO (e.g. a discussion about it on meta or the like)? It's the first time I'm hearing about this...
    – user541686
    Jan 26, 2015 at 7:35
  • 1
    @Mehrdad: No, it's not possible. I personally created and uploaded (relying on the promises made publicly in their FAQ) much of the content that has gone missing, and neither requested nor was informed that it would be removed. The links simply stopped working. It appears that ideone.com believes that "Forever." is actually less than four years. Or they intended to claim a perpetual license to display the content... but that is certainly not what they actually said.
    – Ben Voigt
    Jan 26, 2015 at 19:03
10

I'm not sure that linking to a site is the best way to "prove" this type of "works for me" case. I'd just add a quote (or in an extreme case a screenshot) of the output of something like:

cat file.c

gcc --version

gcc file.c

Sure one can fake such answers... But then one can post a lot of bollocks on this site in general. The way bollocks is kept in check on Stack Overflow is through voting/reputation points.

1
  • The problem isn't people lying/faking it, the problem is people having weird configurations on their computer that they might be forgetting or otherwise not mentioning (e.g. a dev build of a compiler, or a non-default shared library location or include directory, etc.)... the point of ideone is that it's a standard configuration of a standard compiler, so you don't have to try to guess if there are other factors involved that might make something work/not work. It's not an integrity issue, it's a completeness of information issue.
    – user541686
    Jan 26, 2015 at 19:27
5

It's a tricky one, this. I would attack it in the follow ways:

  1. The obligatory standard quote proving that the code is well-formed (if tractible; sometimes you'd have to post half the damn document);

  2. A statement that it built without error on GCC x.y.z, Clang a.b.c, etc. and functioned properly when executed;

  3. A link to the code working, on Coliru.

    • If the link is blocked by Stack Exchange, post it as a comment instead, as a "BTW". This actually fits because both the comment and the link then have the same "storage duration", if you like.

Those first two steps are the permanent, lasting pieces of information; the rest can be trivially recreated at will if ever needs be.

0

There's no real difference between "it works for me" and "I don't know what you're doing wrong".

If the question is "what am I doing wrong" or "why doesn't my code work", then there is no point in posting an answer that effectively just means "I don't know". This is a question and answer site; not a question and I-don't-know site. If you want to help the OP, just leave a comment. And if you do post an answer that amounts to "it works for me", with or without the ideone link, I can promise you that I will downvote it as soon as I see it.

1
  • 2
    I posted more than "it works for me." I write in this meta question: "I checked and found that from my reading of the C++ standard, the code should work and the OP is therefore encountering a compiler bug (nonconformance). I answered to this effect, quoting the relevant part of the standard." So it's not just "it works for me," it's "it must work with a conformant compiler. If it doesn't for you, it's a compiler bug." I can't see this equivalent to "I don't know." Jan 28, 2015 at 11:11
-7

It sounds to me like a comment would suffice, since the question is related to a localized problem that is probably specific to the OP. Sorting out the problem would be a completely different question. So, the question in, erm, question probably ought to be closed in favor of one about the actual problem, in generalized terms.

"Why doesn't this code work" is a close reason for a, erm, reason.

3
  • 8
    If it's a compiler bug then that's not specific to the OP: it's specific to anyone running that particular code on that particular compiler. I think that's worthy of being open. Jan 25, 2015 at 16:06
  • @LightnessRacesinOrbit That's what I think the new question should be about. It sounds to me like the question under discussion is "why doesn't my code work", which isn't about a compiler problem. The asker ought to create a minimal example and post a new question about the compiler issue, the code question is a dead end. XY problem. Jan 25, 2015 at 16:08
  • 5
    In what way would the new question differ from the old question? Assuming for a moment that the original question's testcase was minimal to begin with (because, if it wasn't, the question was off-topic and this entire conversation is moot) then your new question is going to have the exact same code and the exact same interrogation phrase. Jan 25, 2015 at 16:10

You must log in to answer this question.

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