24

There is a (now deleted) question How Leetcode is able to compile a program without 'main()' function? (screenshot for people below 10k rep). It was a newbie question in C++ tag asking "how does Leetcode compile my code if I don't write a main() function?". I thought it's a reasonable question, searched the internet for duplicates, didn't find any, so I answered it, despite it having -3 votes at that time. Then I upvoted the question - if it's worth an answer, it's worth an upvote too.

Then the following happened:

  • the question got closed as "needing details or clarity", which I don't understand - personally I'd prune it down a bit, since not all of that was really required. And maybe edited to improve English.
  • the question got -8 score (including my upvote)
  • my answer got 3 upvotes and 1 downvote
  • the question got deleted

It was not a very high quality question and needs some fixing, but I don't understand why it's "of no lasting value whatsoever" (quote from "delete questions" privilege). Most definitely some other newbies from Leetcode would come across the same question and not find the answer (at least not on Stack Overflow). And yet, seeing the reception of this question, it seems I deeply misunderstand something. At least 3 other trusted users believe not only this question should not be answered, it's actively harmful to the site to keep it around.

Was I wrong to answer this question?

34
  • 13
    "It was a newbie question in C++" - we may have identified the problem. The bar for C++ questions is very high.
    – Gimby
    Commented Jun 19 at 16:07
  • 19
    @Gimby: Is it justifiably high? Commented Jun 19 at 16:13
  • 9
    I feel there's a difference between something that "could be better" and something that is entirely off-topic and should be immediately nuked from the site. Having said that however, it's possible (perhaps even likely) we have an existing Q&A which covers main functions or perhaps even LeetCode specifically.
    – Henry Ecker Mod
    Commented Jun 19 at 16:14
  • 7
    This really needs more details, now that the leetcode part was removed. Are we expected to guess what compiler they used?
    – Cristik
    Commented Jun 19 at 16:21
  • 7
    Also it's a typical Leetcode (insert other misleading crap sites here), without a mcve, or detailed clarification of the OPs actual problem. Commented Jun 19 at 16:22
  • 10
    Actually, by editing out the Leetcode reference the question is now much less clear. Commented Jun 19 at 16:24
  • 5
    @gre_gor It is the question even if OP didn't know it at the start. That's why helpful comments like "this code isn't a complete program, where do you see it working?" can guide the asker to providing more context. The missing details can then be added to the post, and then its a complete question that can be answered. "Currently it doesn't mention even Leetcode" - that context was mentioned at the start and should be added back.
    – kmdreko
    Commented Jun 19 at 16:37
  • 10
    How did that question get out of staging ground? Commented Jun 19 at 17:26
  • 3
    @SecurityHound someone clicked approve and publish. Looks like they felt the question was answerable because a reviewer posted what they thought was an answer in the SG comments
    – Kevin B
    Commented Jun 19 at 17:35
  • 7
    The question was answerable. It was quite clear what the asker was after. It was also doomed to get an absolute shellacking on the main site. In hindsight, I suppose a better action from me would have been to explain why the question, in pretty much any wording, was going to be poorly received and needed to be refocused from "How do I start a program through a member function?" to "Where is the main function coming from?" Still going to be poorly received, but shouldn't have been such an epic bloodbath. I'd hoped I'd answered enough in a comment that the asker would just drop it. Commented Jun 19 at 18:44
  • 5
    What I didn't expect was that someone would push the question through and expose the asker to the absolute shitstorm they got. Commented Jun 19 at 18:48
  • 27
    The asker should not need a MRE, MCVE, or whatever for this question. The question was effectively, "What magic does leetcode use to run this program without a main function?" so the lack of a main that would run the program is the whole point of the question. Commented Jun 19 at 18:52
  • 5
    I would counter that with how is someone who isn't part of the [c++] crowd of SMEs to know such a questionwould be poorly recieved if it leaves the SG, @KevinB .
    – Thom A
    Commented Jun 19 at 20:22
  • 10
    The duplicate closures make sense from the titles, but they're really awful for anyone who actually has OP's question. There's no way they'd get an actual answer to what they're actually asking from that. Commented Jun 20 at 17:16
  • 3
    I don't think there's anything wrong with the question, it's clear what they're asking, and it is on topic (it may be a duplicate, I didn't look). However, the meta-effect has been ridiculous: 38 upvotes and 26 downvotes at the time of my writing this.
    – ChrisMM
    Commented Jun 21 at 12:48

3 Answers 3

21

Note: At the time that this meta answer post was initially created, the latest revision of this main-site post is/was revision 4. If after reading this meta answer post you want to engage in extended discussion with me about my thoughts on this, feel free to ping me in chat.

At least after Tsyvarev edited the title, I don't see a glaring issue (note that I did not check to see if this question is a duplicate, and several dup targets have been suggested, but I'm a unsatisfied with them). It seems like a clear programming question. If that title edit had been made in Staging Ground, I would have then published it. In fact, personally, I think this is a nice, useful question (for C++ newbies). A good teaching opportunity to get into the compile+link build model and to talk about the utility of interfaces.

Could the question be further generalized? Yes. Would generalizing it to the extent that an SME knows how to be better or worse of searchability for someone with a question like it? I think potentially worse. At least coming from the angle of someone doing leetcode challenges. And like it or not, leetcode is not even some tiny little-known thing. I can see this specialized angle to a potentially more generalized question being useful long-term.

I can try to guess why people downvoted it. As Gimby alluded to, SMEs in the C++ tag are pretty involved/active in voting. I think it's probably also a combination of SMEs in C++ having high standards, and some disdain (or some other feeling I don't know) here and there for coding challenge sites. Maybe to an SME, it sounds like a dumb question. I'll try not to judge people's value judgements.

Also, I think the shock in the comments at how this came out of Staging Ground is a little overblown. SG is not meant to fix everything. Reviewers in SG are not expected to be SMEs. Aside from the title improvement Tsyvarev made, which I might have preferred to have happened in the SG phase, I think SG kind of did its job. See for yourself. It's there for fixing general issues that don't require SMEise to evaluate.


I see the question has been closed again as "needs details or clarity". I for one cannot see what detail or clarity it is lacking. I don't know the exact answer to the question with full confidence (are multiple translation units involved and compiled and linked together? or is source text concatenation/inclusion used to build with just a single translation unit? etc.), but I can guess, and I have confidence that if I did some basic investigation (at a level I'd consider normal for an answerer), I could answer with full confidence. And someone else (the asker of this meta question) could answer it (albeit with a little less detail than I think ideal). I've voted to reopen.

Update: I went and did my investigation and wrote an answer post.

To my surprise, a mod thinks that we can't know the answer to this question (leaving the closure explanation "I’m voting to close this question because we can't know, we can only speculate"), when to a large extent, my answer post shows that we can know and don't need to speculate.

Also, to anyone who claims that this question is useless, read the bottom of my answer post on main. The understanding that comes from this Q&A has applications such as optimizing program IO on a highly popular platform for creating efficient solutions to programming problems.


In response to some specific comments:

I suppose a better action from me would have been to explain why the question, in pretty much any wording, was going to be poorly received and needed to be refocused from "How do I start a program through a member function?" to "Where is the main function coming from?" Still going to be poorly received, but shouldn't have been such an epic bloodbath. I'd hoped I'd answered enough in a comment that the asker would just drop it.

SG isn't meant for answering questions. Personal note: I'm of the unofficial opinion that pointing askers to basic pre-readings to suggest they read them if you think it will have significant value in enabling the asker to improve the quality/usefulness of their question post is ok.

The purpose of SG is to improve stuff that is on-topic and steer things into the site's scope where possible/appropriate/reasonable. I think the heart of SG that we want reviewers to have is to want to improve stuff and draw out good potential instead of just hoping that fixer-uppers get washed away and forgotten. Of course, no one can force you as a reviewer to have that heart and put in the time and care to act upon it (I can sympathize with feeling tired at that idea. I feel it too) (of course, we do expect though that you follow basic guidelines. I'm more trying to say that you don't have any contractual obligation or anything to go the extra mile whenever you are capable of doing that). But hopefully you can at least understand it.

I see Staging Ground as an excellent place for a to stave off questions that will be poorly received

The first order goal isn't to stave off bad stuff. It's to workshop stuff and improve it. "Staving off" is for issues like typo/no-repro questions, categorically-off-topic questions, duplicates, etc.

6
  • I don't entirely disagree with the re-closure. The title introduced the necessary context and tried to fix the prose, but it still had what I would consider to be numerous minor grammatical errors and was overall hard to understand. I've edited it again, to try to explain the beginner's apparent confusion in a simple, but correct way, while also mentioning Leetcode again explicitly in the body. Commented Jun 19 at 22:28
  • 10
    @KarlKnechtel if it had enough detail and clarity for you to rephrase it in a way you found more clear, I don't think it needed to be closed for lacking detail or clarity. My understanding of that close reason is that it is for when the question doesn't have enough detail to be answered within the scope appropriate for SE Q&A, or if it is unclear what is being asked or what the problem is- neither of which I thought were issues at rev 4.
    – starball
    Commented Jun 19 at 22:40
  • 1
    Questions that are unclear should be closed until they are clear. It's injunctive, not punitive. Of course, editing the question yourself is much better than marking it down as "this needs to be closed until someone else can edit it" - but not everyone is a competent editor. Some people merely know a good question when they see one. The point is, we should not risk that someone else interprets the question in a different way and then eventually we end up with a mess of answers that are all slightly missing the mark. That's how we ended up with some of our oldest canonicals full of junk. Commented Jun 19 at 23:01
  • All of that said, your edit to summarize the code example is an excellent idea. Now it's even less ambiguous: the question is about the structure of the code, not about the problem it purports to solve or the implementation of the function. Commented Jun 19 at 23:04
  • 1
    @KarlKnechtel I think we at least definitely agree on motivation for clarity in questions. I think we just differ in our evaluation of whether or not this particular question is/was clear at various points in its rev history. I think I might also have a generally more lenient threshold for when to close vote something as unclear (part of this might just be a pragmatic habit of mine. accruing 3 votes to close/reopen is hard, and- perhaps unfortunately- I've come to compensate/compromise by not being stringent (wanted to say "picky", but don't want to put a bad connotation on your threshold))
    – starball
    Commented Jun 19 at 23:11
  • We agree on broad strokes of what Staging Ground should do - get good content onto the site - but we appear to diverge on what to do when this can't or won't be done. Karl and others went beyond the call of duty salvaging this one. It won't happen that often, and it only happened because the initial response to the question was a laughable overreaction. I expected a minus two-or-three, a misguided close reason, and the question lost to the site noise. Commented Jun 20 at 21:06
10

(As of this writing, the question was undeleted, re-opened, then closed again; and I have just edited it and cast a reopen vote again. The process works, but only when enough resources are thrown at it - and when the site is full of people who don't understand the process, it greatly increases the requirement for such resources.)

The question absolutely should have been closed as a main-space question and should not have been allowed out of SG. "The question can be answered" is not sufficient for a question to meet standards, and everyone is expected to take that seriously.

The question should not have been deleted because the issues I describe here were perfectly fixable by third parties.

The voting also strikes me as excessive, and a common habit of tags like and . It seems that there is an attitude that beginners should not be trying to use these languages in the first place, and therefore there is a reluctance to entertain questions that people new to programming could have - even if they unambiguously are within the intended purview of the site. But of course, people are free to vote their conscience without explanation.

If you see a question and think you understand what is being asked, well enough to answer it; but you had to put any effort or interpretation into that understanding (as opposed to putting 100% of the noticeable effort into determining an answer), please, at an absolute minimum, edit the question first before answering such that it conveys your understanding. In the Staging Ground, ideally you should do this first, use the edit comment feature to explain your edit, and explicitly confirm with the OP that you have correctly understood the intended question before considering publishing.

OP got some code from Leetcode, specifically designed to be incorporated into that site's test framework, and was confused as to how it could run. The confusion results from not having any mental concept of a "test framework" - there were unknown unknowns, as often happens with beginners. The question was unclear for many reasons, and SG only managed to fix the issue of making the question self-contained.

Most crucially, to make for a useful Q&A, the question needs to be focused on the apparent actual misconception - that the compiler somehow treats the first listed public member function in a specifically named class as an entry point to a complete program - and frame the question in terms of that misconception.

In my edit, I tried to fix a bunch of general grammatical errors and style issues and lay things out more clearly. In doing so, I think I made the apparent underlying mental model more explicit - which is exactly what's needed for a useful beginner-oriented canonical. And make no mistake: tons of beginners are going to wonder the same exact thing about Leetcode. (It's a shame there isn't a clear way to make the question language-agnostic.)

3
  • 2
    This question has been very meta-educational, but leaves open the issue of just how much work should be undertaken by third parties to salvage a question. And just how much we as a community should tolerate the meta effect. Commented Jun 20 at 21:14
  • @user4581301 we should not tolerate the meta effect at all - until it's our material under fire. Commented Jun 20 at 22:20
  • 3
    @MarkRansom I have been splitting it up in the meta effect and the meta defect. Because there really is a difference between increased activity due to putting something in the spotlight and people not being able to contain themselves and doing curation or moderation actions before it is even discussed.
    – Gimby
    Commented Jun 21 at 7:48
-7

The question, as is, is not a programming question.

The same question, rephrased as an actual programming question:
Is it possible to write a program without using main() function? Score: +40

"How does product X work?" aren't valid questions for SO, unless maybe if product X is an open source project (so answers aren't speculative) and the poster is looking for a specific clarification.

Leetcode is not open source, it's a commercial product. Anyone who answered the question is speculating or reverse engineering the product. (Unless they happen to work at Leetcode and are giving away company secrets)
Equally important, this kind of reverse engineering question is strictly against Leetcode's ToS.

attempting to decompile, reverse engineer, or discover the source code or underlying ideas of the Service, are strictly forbidden.


13
  • 6
    re "closed source": meta.stackoverflow.com/q/424150/11107541. re "speculating". see my answer post (both here on meta and/or on main). for practical purposes, the bulk of the answer is demonstrably possible without speculation. re "not a programming question" I think I see where you're coming from, but for practical purposes, I don't agree.
    – starball
    Commented Jun 21 at 8:47
  • Re: closed source. Nice find. Not sure that I agree (just because it has some upvotes and is the accepted answer does not indicate , and not sure that leetcode belongs in the same category as "software development tools". Notice the same topic that you linked to--the person who said "can be valid" got -25 votes.
    – Mars
    Commented Jun 21 at 8:52
  • Re; being demonstrable thus not speculative--nice find. The answer above yours mostly proves it too. That just makes it a rare, answerable question in a sea of irrelevant questions.
    – Mars
    Commented Jun 21 at 8:55
  • read the bottom of my answer post on main and you'll see that the question has potential practical applications (optimizing IO processing on a highly popular platform for finding efficient solutions to programming problems).
    – starball
    Commented Jun 21 at 8:57
  • @starball A very interesting piece of information! Note that I'm not saying there aren't good answers--I'm saying it's a bad question and possibly more suited for Reverse Engineering.
    – Mars
    Commented Jun 21 at 9:00
  • oops. reverse engineering is against the ToS, so Reverse Engineering wouldn't/shouldn't answer it either :p
    – Mars
    Commented Jun 21 at 9:05
  • 13
    I don't see how I can violate the terms of service having never used the service or agreed to their terms of service. Plus what they're almost certainly doing, in a broad sense, is an automated tester and very widely discussed in the literature, one of the reasons I expected the question to come to a bad end if it got promoted out of the Staging Ground. Commented Jun 21 at 18:07
  • @user4581301 The answers to the question have screenshots, so the "correct" answers very clearly violate the ToS that were accepted by the answerer.
    – Mars
    Commented Jun 23 at 3:10
  • @user4581301 You say: "Plus what they're almost certainly doing" which is clearly speculation.
    – Mars
    Commented Jun 23 at 3:11
  • In other words, correct answers require breaking the ToS and all other answers are speculation, which makes for a low quality question and answer in my opinion. It may make for a better question for Reverse Engineering, if they allow speculation, or Software Engineering (although that should probably speculation posed as a question, asking for feedback, instead of the current question)
    – Mars
    Commented Jun 23 at 3:20
  • @Mars Of course it's speculation. There are an infinite number of ways an online judge could operate, but I'm not worried in this case almost all of the possibilities that aren't utterly stupid will follow a general theme, automated tester, and the few that don't and aren't utterly stupid I'd like to see because they would be really cool. Commented Jun 24 at 2:46
  • Just want to follow up because I see +11 votes for @user4581301's comment. IANAL, but I believe that yes, you can run into issues helping someone with reverse engineering a system, even if you were not aware ToS existed. (Aiding and abetting, collusion, or trade secret protection laws)
    – Mars
    Commented Jun 25 at 2:14
  • 1
    Busted for reverse engineering, that I can see. In general, computer law is completely <expletive deleted>ed. But here I was only concerned with the Terms of Service violation. Commented Jun 25 at 18:18

You must log in to answer this question.

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