0

When the shorthand method is not to be used for assignment operators in C/C++?

As there are two syntax for same instruction there must be drawback to any one of them. Can anybody explain that?

9th Jun 2019, 9:09 AM
Satyam Keshri
5 Answers
+ 5
Which language and which "instructions" you are talking about?
9th Jun 2019, 9:11 AM
KrOW
KrOW - avatar
+ 1
It is still unclear. Can you please say what are the 2 syntaxes you are referring to?
9th Jun 2019, 3:56 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
x += (some + very(long)) / expression is easier to read and understand than x = x + (some + very(long)) / expression It might also be more efficient on some compilers. But mostly it is for looks. "x =" means "replace x" and "x +=" means "modify x".
10th Jun 2019, 4:11 AM
Vlad Serbu
Vlad Serbu - avatar
9th Jun 2019, 9:21 AM
Satyam Keshri
0
x+=4; x=x+4; The two syntax above are performing same instruction. So what is the merits and drawback of using an alternate method(x+=4)?
9th Jun 2019, 7:02 PM
Satyam Keshri