13

This is for discussion of the question Why is the sum of an int and a float an int? After several rounds of closing and reopening it without any clear consensus in sight, I think this should be put for discussion. There are some aspects to discuss, please add your answers on them:

  • Is this a good or a bad question?
  • What makes this a good/bad question?
  • Should this question be closed and, if so, what's the appropriate close reason?
  • Which tags are appropriate for the question?
  • Should the asker gain reputation from this question?
  • Should the answerer gain reputation from their answer?
7
  • 2
    I think closing the question as unclear is fair. The OP failed to address any of the comments asking for clarifications, and - although neither C or C++ are toys I usually play with - I suspect answering those comments could alter its answers. That said, kudos for bringing this up on meta. The close / re-open war there looks a bit silly.
    – yannis
    Commented Aug 1, 2017 at 8:14
  • 1
    @yannis In this special case, no, it wouldn't change anything about the answers, that's my point in my own answer below. It's definitely coincidence (so, the asker somehow did it wrong, yes), but the question indeed has a clear and unambiguous answer in the state it currently is.
    – user2371524
    Commented Aug 1, 2017 at 8:16
  • @yannis and I guess this coincidence is the reason for this "silly" fight ;) The asker missed to add information that would be very important in most cases, still in this case, the question isn't unclear without it...
    – user2371524
    Commented Aug 1, 2017 at 8:18
  • 2
    The question should be put on hold (“Questions seeking debugging help…” seems to fit best) until the asker clarifies how they were compiling it. Holds are fine and the answer’s going to fit either way, but it really does need to be clarified in the question how the code was compiled since the problem was a mistake in compiling (even if the explanation of the behaviour remains the same).
    – Ry- Mod
    Commented Aug 1, 2017 at 8:23
  • 1
    @Ryan That's probably a better matching close reason I didn't even think about. Still I think a question only needs to be put on hold if improving it is necessary for a good answer -- and here it's already obvious the code was compiled with the "wrong" compiler or compiler options, so the answer already clarifies this. Then why put it on hold at all?
    – user2371524
    Commented Aug 1, 2017 at 8:26
  • Can't those that claim the question is "clear" ask another one, but with clear indication of what, why and how?
    – Braiam
    Commented Aug 1, 2017 at 14:34
  • After the "return of the OP" ;) we know for sure that the answer is on the point. I would only agree the question wasn't clear if someone is able to give me a different interpretation that actually makes any sense. (but it's interesting that so far, the votes on the different answers here reflect that fact that there's a strong disagreement about whether the question was clear ...)
    – user2371524
    Commented Aug 1, 2017 at 14:52

5 Answers 5

8

As the answerer I thought I should give my piece of 8:

I love questions like this where, seemingly, a unique and crystal clear answer is extractable from the quagmire of the asking. But as I suspect that was more by luck than by judgement on the part of the OP, I believe there is room for improvement on the part of the question despite it being sufficient for an answer. One of my personality flaws manifests itself in my finding questions like this simply irresistible in order to appear cleverer than I really am.

I have also observed that a highly upvoted answer seems to also put the question in favour too. To me that goes some way to rationalising the upvoting and voting to open. Notwithstanding the fact that the question title is catchy.

The fact the question is poor rationalises the voting to close. The OP choosing to go utterly incognito doesn't help either. Concerning the history of question closure and re-opening the post is on that precipice of being good in the eyes of some, and poor in the eyes of others in a balance whose deviation from equality is seemingly impossible to conject. Prior to the question locking the site mechanics played out: since you only get one vote (per side), a statistical consensus was eventually reached.

On the tags: I do confess to not clicking on the cppreference link in the question prior to answering. In omitting that I hadn't realise it was to a C page on that site. To me this implies the question was a mistagged pure C question and the initial drafts of my answer were too biased towards C++, where it is possible to contrive a floating point type for sum using auto. Although I've retained that I believe the current principal tag is correct, perhaps allowing for too. @Olaf in particular was helpful in formulating the final question state, and convincing me of this.

Finally, I believe we got there in the end; in some ways it's a pity it required moderator locking to finalise the tags, but it validates the wider Stack Exchange model, to me at least.

4
  • 1
    "irresistible in order to appear cleverer than I really am." <- had to smile at this one ;) But uhm ... "let the site mechanics play out." <- this lead to a silly ping-pong that will end in some indeterminate state once people get tired voting. Fine for me, it doesn't hurt either way, I only thought with such a case of disagreement, some discussion would be nice.
    – user2371524
    Commented Aug 1, 2017 at 9:27
  • 2
    Kudos to you for enjoying the "sussing out what they're asking" part of the SO experience as much as the answering. One of the things that annoys me about SO is the overwhelming propensity to hound questioners to ask questions "properly". Yes, asking good questions helps, but it's also hard. If you insist that OP's always ask their questions properly, why not go one step further, and insist that they answer them also? That makes answering even easier. Commented Aug 1, 2017 at 16:12
  • 2
    @SteveSummit - "Yes, asking good questions helps, but it's also hard" nobody said it's easy. But the strength of SO is that it's both free and of good quality. If we let the quality slip just to help everybody the entire endeavor will become cesspool of bad advise. It's already bad, since many novices don't seem to even try to even think about their problems anymore, they just ask on SO. Commented Aug 1, 2017 at 17:50
  • Unfortunately, in your edit I see Olaf convinced you of something I consider wrong. Have a close look at revision 17 to understand why. The OP explicitly stated he got the "expected" result of 4.14 now. This is only possible with C++. The whole problem here is that obviously, OP didn't know that C++ and C are not the same, and no matter how often we write this in answers and comments, some people just don't get it. Maybe the answer should have made this extra clear ;) But still, OP expected C++ behavior, there can't be any doubt about that.
    – user2371524
    Commented Aug 2, 2017 at 8:55
7

Is this a good or a bad question?
What makes this a good/bad question?

It's bad. It doesn't follow the good question guidelines. The fact the entire C and C++ community on SO was in an uproar is testament to that. If it had been asked clearly, then it would be good without question.

However, the deduced topic of the question is indeed very good. And assuming it's true, the question can be very good. Shame the OP left it at this state so far.

Should this question be closed and, if so, what's the appropriate close reason?

Yes it should, for the same reason it was closed several times. It is of low quality and needs much clarification from the OP. If such an improvement ever comes, it must be reopened promptly IMHO.

Which tags are appropriate for the question?

At what stage? The OP linked to a page describing C semantics of the auto keyword, but vaguely described they expect C++11 semantics. This goes towards the question being unclear. Tagging appropriately should not be subject to speculation. If the scenario Bathsheba caught on to is indeed the case at hand, and the OP clarifies that it is, then I think and are appropriate.

Should the asker gain reputation from this question?

Not for clarity or even willingness to clarify. The question is poorly asked. But if the subject is to change, then a good question means the asker deserves the reputation.

Should the answerer gain reputation from their answer?

That's an unequivocal yes. It took insight to piece together the scenario. The answerer deserves full credit for it. It's not unheard of for diamonds to pop up in the muck of a bad question. The SE model even encourages marking answers for merger into duplicates if they are good. We want to keep good answers around, and rewarding those who give them is part of it.

3
  • 2
    "The fact the entire C and C++ community on SO was in an uproar is testament to that." I think one motivation for closing questions like these is that people don't like the resulting uproar. But the uproar is caused by truculence and lack of consensus among SO regulars; it's not the questioner's fault for triggering this. Commented Aug 1, 2017 at 15:52
  • @SteveSummit: I strongly disagree. It very well is the askwer's fault. Who else wrote that question? Who added tags for completely different languages? Who else abandoned the question? But then, it is also the fault of those who wanted to keep the question open under all circumstances. Who made assumptions beyond what's given by the question? The link to a C text should have been hint enough about the askwer's target. Those regulars are well aware beginners way too often confuse C and C++ and add both tags to gain attention. Commented Aug 1, 2017 at 16:16
  • @SteveSummit - Disagreement is part of the human condition, nobody accused the OP of that. The uproar is a symptom. Naturally no one expects all posts to be 100% clear from the start. But a post must be made clear to fit the site. That OP ignoring those request is a fault of theirs, it's been over a day. Commented Aug 1, 2017 at 16:54
4

Is this a good or a bad question?

What makes this a good/bad question?

Should this question be closed and, if so, what's the appropriate close reason?

I believe this question was unclear and lacked a MCVE, and is now a typo. The OP asks why C++'s auto keyword wasn't working properly, and the answer is that he was using C, not C++. The "bug" was with how he was compiling the program, not anything with the code he provided.

Before revision 17, the question was unclear and lacked an MCVE. The provided snippet did not reproduce the problem, since the problem was with how he was compiling (which he did not specify).

In revision 17, the OP finally clarified that he compiled the code as C. I would argue that the question is now a typo, as it was resolved in a manner that is unlikely to help future visitors. Someone else with the same problem is fairly unlikely to notice it while adding a float and an int -- it's possible, but there's dozens of other ways this problem could manifest itself. If someone else mistakenly compiled C++ code as C, how likely are they to google "Why is the sum of an int and a float an int?"

Which tags are appropriate for the question?

I don't have much of an opinion on this, but I'd say both and are appropriate since the OP meant to use C++, but was using C. The question was not solely about either of the languages; it involved both.

Should the asker gain reputation from this question?

I don't believe the question deserved that many upvotes, but there's not much we can do about it.

Should the answerer gain reputation from their answer?

Yes. Even though it's a poor question, the answer is good answer, and the answerer should receive reputation from it.

2
  • I like what you write here, although I don't fully agree with the conclusion. It isn't unlikely someone else runs into the same problem, because it might be enough to use a C++ compiler that doesn't know C++11 and newer. Often, these compilers allow implicit int although forbidden in C++. But interesting point about the question title, it's indeed not ideal for ppl with the same problem to find the question.
    – user2371524
    Commented Aug 1, 2017 at 17:16
  • @FelixPalmen It's likely someone else will run into a similar problem, but it's not too likely that they'll experience it while adding a float and an int. We may be able to edit the question into something easier to find though.
    – NobodyNada
    Commented Aug 1, 2017 at 17:19
2

Is this a good or a bad question?

I personally think it is a great question, see below.

What makes this a good/bad question?

First of all, this question fails to fullfill many of the requirements given in How do I ask a good question?. But I'd argue that although these guidelines help writing a good question, not meeting them doesn't necessarily make a question a bad one. See for example How to exit the Vim editor?, How do you set, clear, and toggle a single bit? or What does "static" mean?. Are these "bad questions"?

In my opinion, a good question is one that can be answered without doubt and has the potential of being helpful to other readers as well. Following How do I ask a good question? is a good way to write good questions, still some of the greatest questions on the site don't. The question discussed here is caused by semantic differences of an old C standard and a newer C++ standard that aren't obvious to the asker, and it's not unlikely someone will hit the same confusion in the future and find the exact answer on SO. Isn't this what we want? It makes SO the invaluable resource it is today. Of course, the question doesn't mention that the asker tried to compile the code with either an older C++ compiler or a C compiler, but that's because the asker obviously wasn't aware ot that and the consequences, so the answer explaining it is very helpful.

Should this question be closed and if so, what's the appropriate close reason?

A good question should only be closed as a duplicate, if there is an exact one. This isn't the case for the discussed question. Another good reason to close a question is when it needs to be improved, so it can be reopened later. Some argue that this question needs clarification on which language the asker wants to use, therefore it should be closed as unclear what you're asking. In my opinion, although this information would definitely improve the question, it isn't needed in this case. From the result the asker expects and the one he gets, the question is absolutely clear, because there's only one possible explanation. The question would benefit from improving it, but it doesn't need to be improved, therefore it shouldn't be closed.

Which tags are appropriate for the question?

The question was originally tagged and . This is almost always wrong, but there are exceptions, e.g. when the question is about differences between those two languages. Although it's very likely that the asker wasn't aware of that, it turns out the question is indeed about differences, so in this case, those two tags are appropriate. In my opinion, the tags and should be added as well, because these are the exact versions of the standards that specify the things leading to the original confusion.

Should the asker gain reputation from this question?

My personal "feeling" here is: no. There's just too little effort going into this question, it's a good one merely by accident. But then, this is how SO works. The question is good, so it receives upvotes. This is IMHO not ideal, but I don't see what could be done about it.

Should the answerer gain reputation from his answer?

Definitely. Although I think the current score is a bit excessive (again, caused by just how SO works), it is a very helpful answer and should be honoured.

1
  • 2
    It's useful to future visitors who have to survive new language 'features', so it's a good question. OTOH, I think that the language developers should be downvoted, closed and deleted:) The overloading of terms like 'auto' is rife in language development and just causes confusion and/or bugs. It's not just C++, Java has an 'interrupt' feature that a) is not guaranteed to interrupt, and b) is easily confused with the 'interrupt' term already understood by OS, driver and embedded developers for decades:( Just don't get me started on 'static'...:( Commented Aug 1, 2017 at 8:18
-2

This is certainly not a "bad" question. (Or maybe, it's a good question in the real world, but a bad question in StackOverflowWorld.)

It's a terribly, terribly confusing question, but that is not the fault of the question. If you want to blame anything, blame the C++11 redefinition of the auto keyword. Seriously. That's where all the confusion comes from.

If we claim that this is a "bad" question, I think what we are saying is that the only "good" questions are the clear, concise questions that have clear, concise answers. But the real world doesn't work that way. The real world is messier sometimes. The messiness is why people get confused and ask questions. If it's not our job to help in those situations, what is our job?

Yes, it would have helped a lot if the OP had clarified as requested. But (I guess I'm an old softie) it's not realistic to expect people (especially low-rep newbies) to do that all the time. They post their question, they get their answer, they're in a hurry, they move on.

And in this case, at least, the answer is better for the confusion. Instances where behavior varies so wildly between C and C++, and in this case between different versions of C++, are rare. So if the question had been "properly tagged", and if the answer(s) had given only the C89 answer, or the post-C89 answer, or the pre-C++11 answer, or the C++11 answer, those would have been less useful answers. Few programmers work exclusively in exactly one of those dialects; all experienced C and C++ programmers ought to know the peculiar history of the auto keyword, because it's going to trip them up some day.

(Not that it really matters here, but: The C++11 treatment of auto ends up serving as a terrific answer to a frequently-asked question: "Can you write a program that's strictly conforming in both C and C++, but yields different results?")

I understand there's a huge tension between "helping people" (including the confused ones whose questions are "poor") and "building a repository of high-quality questions and answers". I don't mind so much if the question gets closed, as long as it remains on the site. (It's weird, though, to see a question that's so highly upvoted, and closed.)

29
  • You could blame K&R for the initial implicit int for declarations without a type. Or maybe, C99 for disallowing this as well. If I understand one of the comments at the original question comment correct, auto i = 10; has never been valid C++ (at least since its standardisation), so there is not ambiguity in C++. For C, the implicit int was a major flaw which has been corrected 18 years ago. We hardly use 10 year old phones, but to program our most modern systems, people insist on using a C version which has been outdated 18 years ago. Does not make sense to me. Commented Aug 1, 2017 at 16:10
  • The actual problem is if questions like that should be answered at all or edited by answerers to suit their answer. I don#t think so. That's what close-votes are for. "Too broad" or "unclear" are fine. The question also lacked a mcve to show how the output was generated. That's three valid close-reasons. Commented Aug 1, 2017 at 16:12
  • 1
    @Olaf One of the fundamental underlying tensions is between helping people, and strictly obeying the rules of the site. Commented Aug 1, 2017 at 16:15
  • 1
    @Olaf This isn't the place for a personal comment, but I don't know where is, so I'll say it here: You're very smart and knowledgeable about C (and perhaps C++ too, I don't know), and I respect that. I wish you'd spend more time answering questions, and less time criticizing the questions and answers of others. Commented Aug 1, 2017 at 16:17
  • There has been enough help by the comments - as often for questions which are off-topic. While that's also - strictly speaking - against site-rules, it is tolerated practice. Nevertheless, those questions are closed, because they are indeed not good for the site. You alread mentioned, this site is not to help the askeer of a question (that's more of a side-effect), but to help others. If someone had wanted to help, two new questions, one for C and one for C++ should have been asked and self-answered. Commented Aug 1, 2017 at 16:20
  • 3
    @Olaf "People insist on using a C version which has been outdated 18 years ago". No. People insist on acknowledging the history of 18 years ago, and the effects it has on present-day practice. People insist on not insisting that 100.0% of all programmers remain 100.0% consistent with the most up-to-date-standards, 100.0% of the time. People insist on understanding that it may take some people more time to catch up to the most modern practice than others, sometimes for good reasons. People insist on remembering that backwards compatibility is important. Commented Aug 1, 2017 at 16:21
  • As my last comment on this and a personal reply: I'd wish there were more answerable questions here. But quality on the C tag has decreased and questions are mostly about things better be read in a C book. Particular questions are not good to learn C. One need to get the whole picture and some of the fundamental concepts. There are in fact not that many. problem is a answer covering all aspects will be way too broad; remember we are not a tutoring site. I see a lot of other regulars/high rep users for the C (and the C++ tag) which are just tired of those reputation-hunters … Commented Aug 1, 2017 at 16:24
  • … who answer ever yet-so-simple typo question, just to gain reps (at least that's how it looks like). Maybe that's becaue we don't get reps for finding dupes which also often takes longer than a short answer. But that's indeed not how I see this site and what the rules state. I will think about my further contribution. As-is, I don't see much use and the C-tag (at least) quality clearly degrading. Commented Aug 1, 2017 at 16:27
  • @Olaf Thank you. I can't disagree with any of that. The quality of the questions on the C tag is abysmal, it's true, although I take comfort that it reflects the fact that SO is well publicized and has been found useful. Commented Aug 1, 2017 at 16:29
  • 1
    Ok, one last post: I certainly shows SO is well known. And If it is to be turned into a "ask anything" community, so be it. But I'm not willing to support this. Call me pretentious or elitist, but I don't see any use in programmers who lack basic search-skills or the ability to apply even the most simple concepts. In other worse: If that's what the community wants, I'm out. (And from the discussion at the question, I have a bad feeling about that). Users agreeing with me are welcome to keep quality high. We will see … … … Commented Aug 1, 2017 at 17:27
  • @Olaf It's good to finally see some explanation how you feel about this site. But I can't agree that the general quality is on a downswing, maybe because although there's a huge torrent of garbage questions, they are normally sorted out quickly. What do you think of the questions I put as examples in my answer here? "Low-quality" by site standards, still, they are a) old and b) well-received? I'd say they are good for the site. Do you disagree on this? I see the question under discussion here in a similar category, it doesn't meet the site standards, still it is about an interesting effect ...
    – user2371524
    Commented Aug 1, 2017 at 17:33
  • 4
    The question was obviously a C++ question. (1) tagged [c++]. (2) mentioned cppreference.com. (3) Presented a code fragment that was clearly (if confusingly) trying to explore the new C++11 usage of auto. You can only believe it was originally a C question if you believe (a) someone still uses auto in C and (b) threw it in as the world's biggest red herring in an utterly uninteresting question about ordinary float->int truncation in C, and that badly strains Occam's Razor! Commented Aug 1, 2017 at 18:10
  • 1
    @Olaf - "Evidence is ignored"? That's rich. Did you not notice the "I expected this to be float as said here <insert wrong link>". That's expected C++11 behavior to anyone with even basic knowledge of the standard. The only one who is ignoring evidence is you. Pot calling the kettle black, honestly. Commented Aug 1, 2017 at 18:38
  • 1
    @Olaf - This isn't about the expression, it's about the OP expecting the variable to be float too. We would also mince less words if some other users give up their passive aggressiveness and holier than thou attitude. Commented Aug 1, 2017 at 19:07
  • 2
    A newbie approaches the pinnacle of wisdom and asks, "Oh masters, what is one plus too?" Quickendirty master promptly answers, "Threee!" Didactic master patiently explains, "Did you mean 'one plus two'? That's three. 'too' isn't even a number, although it is a homophone for 'two'." But then there's also Pedantic master, who is muttering "Your question makes no sense. It isn't even grammatical. We can't answer it until you fix it." Commented Aug 1, 2017 at 19:12

You must log in to answer this question.