6

I'm new to SO and often stuck about questions on C++ (and author is claiming it with tags or inside post), but OP shows only C-style code without any trace of C++. Also, such threads may look like that OP is learning C++.

I.e.: using enum for an array index in c++

How to answer such questions?

  • Open a door for OP to a brave new world of C++ (enum classes, etc.). It is good chance that topic starter get new knowledge through that, but also a big chance, that OP still true to C subset of C++, and your answer getting rejected, and your work is useless.
  • Answer like anything fine and provide dirty C-stylish workaround.
  • Avoid such questions like I do now.
1

1 Answer 1

8

If it's valid C++, trust the OP that he's writing C++.

If it's not valid C++ but valid C (or whatever), ask the OP (unless in blatant cases), whether he's mistaken.

There's nothing wrong with writing low-level-C++.
Though you might of course suggest a cleaner, faster, safer and more idiomatic higher-level way. Be aware that the alternative way might fail one or more of those points, which might be crucial. And anyway, he might be trying to build the tools himself for practice.

2
  • 1
    The OP has void main(), which says a lot.
    – user3920237
    Mar 6, 2015 at 0:44
  • 1
    Well, yes, that means he's completely lost. Tripple-check everything. (Unfortunately, that happens quite often.) Mar 6, 2015 at 0:46

You must log in to answer this question.

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