10

I was trying to post a question to Stack Overflow but I can not because it

doesn't meet quality standards

How can I know what need to be fixed in my question so it become "meeting quality standards"? Adding question below

In c++ I can declare field as regular variable of some type, instatiate it in constructor, and use it later:

private:  Foo field;
...

A::A() {
    field = FieldImpl();
}
....
method(field);

Or alternatively i can use pointer:

private:  Foo* field;
...

A::A() {
    field = new FieldImpl();
}

A::~A() {
    delete field;
}

...
method(*field);

What is prons and cons of declaring field as pointer? When declaring field how to decide if I should use pointer or regular variable?

19
  • 8
    Thanks for asking here and not on StackOverflow itself.
    – tombull89
    Commented Apr 18, 2013 at 9:43
  • 3
    See that lowercase i (between the code blocks) - that's bad English. Use an uppercase I when writing about yourself.
    – Oded StaffMod
    Commented Apr 18, 2013 at 9:46
  • 4
    This doesn't seem like a typical low quality post. I'd capitalize that "i" in "alternatively i can use pointer" and completely remove the "prons and cons" sentence. "pros and cons" questions don't really fare well on Stack Overflow, the site is focused on questions about specific problems, not "pros and cons" lists. These might seem like very small fixes, but it might just be all you need to do.
    – yannis
    Commented Apr 18, 2013 at 9:47
  • 2
    Some use of the indefinite article a might help too: I can declare a field as a regular variable and alternatively I can use a pointer. Commented Apr 18, 2013 at 9:49
  • 2
    What was the question title ?
    – asheeshr
    Commented Apr 18, 2013 at 9:49
  • 1
    @AshRj sorry i don't remember title already but it was fine for me... the problem i see here is that relatively valid post is considered as "low quality" and there are no hints how to improve it... Commented Apr 18, 2013 at 9:54
  • If you used the words "problem", "help", or synonyms, then the title is the problem, not the body.
    – asheeshr
    Commented Apr 18, 2013 at 9:55
  • 2
    There are no hints, so people can't simply change exactly what's needed and leave the rest in a shambles. I'm not saying your post is a shambles - it's certainly better than most that used to show up on SO - but if you knew just what you need to fix, you'd fix only that. Not all of it. =)
    – J. Steen
    Commented Apr 18, 2013 at 9:59
  • 3
    However, there could be some hints on what "quality" means. Capital "I" when writing about yourself in English is, apparently, not obvious in some cultures.
    – J. Steen
    Commented Apr 18, 2013 at 10:06
  • 1
    i've found titles i have tried. it was "pros and cons of declaring field as a pointer vs declaring it as regular variable". i also tried to replace "vs" with "versus". I just tried to replace "i" with "I" but this doesn't help I still unable to post. Commented Apr 18, 2013 at 10:17
  • @Amicable What are you talking about, who's voting to close for spelling mistakes?
    – yannis
    Commented Apr 18, 2013 at 10:18
  • @javapowered: Have you tried removing the "pros and cons" stuff from the question? Just focus on what you're looking for: which one is correct. Commented Apr 18, 2013 at 10:37
  • 1
    The quality filter was changed very recently (yesterday, I think) to block low quality questions. I agree you are innocent victim of this, but the gain is better overall quality. What if you just remove the lines with "..."? Commented Apr 18, 2013 at 12:52
  • 3
    This is probably because they increased the quality filter threshold yesterday. Try adjusting the wording of your first sentence to try and make it proper English, as it's missing a few "a" and "the" words, and I think "instantiate" is misspelled: "In c++, I can declare a field as a regular variable of some type, instantiate it in the constructor, and use it later:"
    – Rachel
    Commented Apr 18, 2013 at 12:54
  • 3
    @Rachel: Stack Overflow already rejects something like twelve hundred questions a day. It would be impractical to craft a custom response to even a small fraction of these. There's plenty of actionable advice available at the duplicate questions.
    – user102937
    Commented Apr 18, 2013 at 17:57

1 Answer 1

7

In c++ I can declare a field as a regular variable of some type, instantiate it in the constructor, and use it later:

private:    Foo field;
...

A::A() {
    field = FieldImpl();
}
....
method(field);

Or alternatively I can use a pointer:

private:    Foo* field;
...

A::A() {
    field = new FieldImpl();
}

A::~A() {
    delete field;
}

...
method(*field);

When declaring a field, how do I decide if I should use a pointer or a regular variable?

6
  • 2
    The title of your question should be the last sentence above.
    – user102937
    Commented Apr 18, 2013 at 15:16
  • 5
    you forgot to capitalize i's in prIvate: Foo fIeld
    – gnat
    Commented Apr 18, 2013 at 16:04
  • @gnat I'm sorry, your improper apostrophe makes your comment too low quality.
    – user206222
    Commented Apr 18, 2013 at 16:09
  • thank you, just posted! stackoverflow.com/questions/16089778/… So my initial post was considered as low quality only because of grammar? Commented Apr 18, 2013 at 17:45
  • 3
    @javapowered: Questions that are posted with bad grammar have a high degree of probability of being closed for other reasons (off-topic, not constructive, etc), so we save ourselves a lot of time, effort and trouble by simply blocking those questions.
    – user102937
    Commented Apr 18, 2013 at 17:52
  • 1
    @RobertHarvey I guess this also has something to do with too little text "outside" of the code. At Programmers, I often DV and comment questions like that with Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How To Ask
    – gnat
    Commented Apr 18, 2013 at 18:13

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