Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7399329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:02:49+00:00 2026-05-29T04:02:49+00:00

I recently installed Checkstyle plugin for Eclipse and personally think that it is awesome.

  • 0

I recently installed Checkstyle plugin for Eclipse and personally think that it is awesome. But one of the warnings it gives me is a bit obscure. The exact warning is “Using ++ is not allowed”. It is about postfix ++ in some row like

for(int i = 0; i < SOMETHING; i++)

Ok, I ‘m aware that foreach is the better construction for iteration, but it can’t be applied everywhere, sometimes old-school ++ is the only alternative.

When I change the row to

for(int i = 0; i < SOMETHING; ++i)

the warning disappears. I know the difference between i++ and ++i and to this point of my life I considered them interchangeable in standard for construction. But Checkstyle considers i++ harmful (or error prone).

Question: Why prefix incrementation is better than postfix incrementation in for constructions? Or… is it Checkstyle wrong about that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:02:51+00:00Added an answer on May 29, 2026 at 4:02 am

    Postfix incrementation makes sense only when used in an expression where you need the old value prior to the modification. In void contexts where that value is discarded (as is in your for loop), saving the old value makes no sense.

    In other words:

    // makes sense because you need the old value to subscript the array
    stack[top++] = x;
    // in a void context, the old value is discarded
    top++;
    

    In C++ in particular, both of these operators can be overloaded, and the implementation of the postfix one can be inefficient because of the requirement to return the old value – it usually involves copying the old object to comply with the original semantics of the postfix operator.

    With primitive types, any decent compiler will produce identical code for both of the cases, but the second one is better from the semantic standpoint of the language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently installed the Eclipse Metrics Plugin and have exported the data for one
I recently installed the technoweenie / restful-authentication plugin (which works as promised), but while
I recently installed the autotools plugin for eclipse. I made the Makefile.am for each
I recently installed PHP on IIS/Windows 7, but it isn't working. I am getting
I recently installed jruby on a machine that also has ruby installed on it.
I recently installed twython, a really sleek and awesome twitter API wrapper for Python.
I recently installed/updated eclipse environment. When I try to compile the code I'm getting
I recently installed Node.js on a fresh Linode box, and I think I'm in
I recently installed the BIRT all in one developer program and started fooling around
I recently installed Visual Studio Professional 2010 Beta 1 and noticed that most of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.