-1
\$\begingroup\$

I answer a question with a C language tag and got down-voted for using #define rather than const or static for defining constants. One of the constants is defined in terms of the other constants. When using #define this compiles fine using gcc, when using const I get a compilation error. gcc forces the use of Standard C, g++ compiles everything as C++. Should g++ be used over gcc at all times? There are 2 things I should be down voted for on the answer (2 warning messages are generated) but what I was down voted for was the use of #define over const or static.

I asked a question about proper usage of #define versus const on stackoverflow https://stackoverflow.com/questions/36237841/how-to-define-a-static-const-using-previously-defined-constants-in-c. The answer was to use #define.

\$\endgroup\$
  • \$\begingroup\$ This is about Stack Overflow, not Code Review. You picked the wrong meta. \$\endgroup\$ – Mast Mar 27 '16 at 17:41
  • \$\begingroup\$ Is this the comment you are referring to? \$\endgroup\$ – 200_success Mar 27 '16 at 17:47
  • \$\begingroup\$ The first comment and the fifth comment. \$\endgroup\$ – pacmaninbw Mar 27 '16 at 17:59
  • \$\begingroup\$ The original question that caused me to ask the question on stackoverflow is codereview.stackexchange.com/questions/123848/… \$\endgroup\$ – pacmaninbw Mar 27 '16 at 18:57
3
\$\begingroup\$

There is no site policy on which compiler to use or assume. (I've removed that tag from your question.)

Meta is not a good place for debating the technical merit of an answer. It could be a place to raise awareness of systematic abuse of voting, but your post isn't about that. Answers can be discussed in comments; if it's too complicated to be discussed in comments, then in chat.

\$\endgroup\$
2
\$\begingroup\$

Which compiler should I use when reviewing an answer?

As 200_success's answer states, there is no site policy for which compiler to use or assume. This isn't just for , but for everything.

However, some questions will specify that the asker is using a particular compiler. If you come across one of those questions, you should use & assume that compiler.

Otherwise, if the question doesn't specify a compiler, then your answer should highlight any parts of it which are compiler-specific. If you do this, users using that compiler can choose to take your advice, and users using other compilers can safely skip over that section of your answer.

\$\endgroup\$

You must log in to answer this question.

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