51

I have recently started my first bounty on my own question to draw attention to it. It worked really great, now I got some answers: Can I access a static local while it is being constructed in C++?

In particular, there are two answers very interesting for me. The one explains why the problem occurs, and directly addresses one of the bounty criteria. But it does not offer a direct solution.

The other is a good solution that I will probably use in my situation. However, it does not provide a solution in the criteria I outlined in the bounty (which I learned from the former answer, is not possible).

So is it ok to award the bounty to the former, but accept the later? Or is this considered bad etiquette?

3
  • 40
    Sounds reasonable to me. Commented Mar 17, 2016 at 13:09
  • 3
    "Or is this considered bad etiquette?" By whom? An answer on that might be quite opinion-based. I wouldn't mind, but I would actually like a comment explaining why you choose to split the rewards like this. Commented Mar 17, 2016 at 13:59
  • 5
    it's totally fine. stackoverflow.com/q/20565126/1771795 spend your money the way you want.
    – Omar
    Commented Mar 17, 2016 at 18:04

2 Answers 2

56

You can award the bounty, accepted answer and any associated up or down votes how you want. There are many cases around Stack Overflow where the bounty went to an answer that is not the accepted answer.

Do note, though, that if you do not award the bounty and an answer posted after the bounty period started gets a score of 2 or more, it is eligible for half of the bounty to be awarded automatically.

3
  • 1
    So edited answer that were there before the bounty started and got upvoted more than 2 aren't eligible for the automatic award?
    – AXMIM
    Commented Mar 17, 2016 at 17:37
  • 5
    That is correct. It can still be awarded the full bounty by the person offering it though.
    – Andy Mod
    Commented Mar 17, 2016 at 17:38
  • Suppose multiple answers with a score of two or more are posted after the bounty period starts. Does the automatic bounty get split equally between all the answers? Commented Mar 19, 2016 at 14:55
3

As @Andy said, yes it is fine. That said...

  • What criteria (if any) did you attach to the delivery of the bounty? As I read your question I do not see anything, but if you said "bounty will be given to answers that..." then that is what will be expected.
  • Which question best answers your question? If the first answer provides the best answer to your question, then technically (unless otherwise state) it should be marked as correct and get the bounty. The second answer's work around, though valuable, does not deserve the bounty and should not be marked as correct. If you want to give them a bounty you could (correct me if I am wrong) let the poster know, create a new question asking for a workaround and ... I think you get the rest.

Your post has a slight problem, you asked two questions (which is forbidden for good reason). - "Is this situation really undefined behaviour? Or is it a compiler bug in VS2015?" - "What is the best solution to such a situation, prefably without dropping a full constructor, and RAII?"

While you could have stated that the bounty would only be awarded to an answer with both answers, I would not have since it would probably be too much to ask of any one answer-er.

At this point I would make sure that the answer-er know about this thread so they can voice any concerns, then apply the bounty as you see fit. You could also try to use the automated process to split the bounty, but I do not know if this is possible or reasonable.

If you follow the above guidlines in the future you will probably not have this issue, but either way, feel free to add a comment on the answers expaling why you did what you did, "I gave you the bounty because you gave me a solution as requested."

3
  • 2
    It's in the bounty notice: The solution must work in VS2015. It should not require changing the structure from a singleton to e.g. dependency injection. It should not be the possible solution outlined in the question, i.e. moving constructor code into the getInstance() method + using some kind of manual mechanism to ensure the instance is deleted on program exit. Instead, it should (if possible) show a simple solution using C++ features to ensure that. If NOT possible, the answer should contain details about why it is not possible. A clear reference stating that this is UB is sufficient. Commented Mar 17, 2016 at 20:17
  • @NathanOliver That still does not unify the two questions. "Is this really undefined behavior? Answer is yes, and here is why...." is one QA set. "How can I fix this? You can fix it by ..." is another. While many similar questions work because the additional questions are mutually exclusive, these are not, as shown by the dilemma presented in this meta question.
    – Trisped
    Commented Mar 17, 2016 at 23:07
  • 1
    Specifically: "The solution must ..." and "If NOT possible, the answer should ..." are two directions which are not mutually exclusive since a valid solution was presented along with documentation that it was not possible.
    – Trisped
    Commented Mar 17, 2016 at 23:11

You must log in to answer this question.

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