Is it considered "bad style" to use the increment operator (++) on floats? It compiles just fine but I find it smelly and counter-intuitive.
The question: In what cases is using ++ on float variable justified and better than += 1.0f? If there are no use cases, is there a respectable C++ style guide that explicitly says that ++ on float is evil?
For float ++ does not increment by the smallest possble value, but by 1.0. 1.0f has no special meaning (unlike integer 1). It may confuse the reader causing him to think that the variable is int.
For float it is not guaranteed that operator++ changes the argument. For example the following loop is not infinite:
float i, j;
for (i=0.0, j=1.0; i!=j;i=j++);
Consequently doing ++ immediately after -- does not guarantee that the value is unchanged.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)