Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
1699 Discussions

a=b=c; or b=c; a=b; which has higher time efficiency?

fatalme
Beginner
1,342 Views
a=b=c;
or
b=c;
a=b;
Thanks.
0 Kudos
4 Replies
Ilnar
Beginner
1,342 Views

both constructions are equal, first one is just shorter syntacs of the second one

0 Kudos
Dost__Conrad_W
Beginner
1,342 Views
The compiler will optimize them to the same code.
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,342 Views
Quoting conradca
The compiler will optimize them to the same code.

Excepting when b and a are volatile.

0 Kudos
dwms
Beginner
1,342 Views
An interesting exercise would be writing the code to do both and then reviewing the assembly generated by the compiler.
Assuming this is not a complex data type, don't forget:
a=c;
b=c;
0 Kudos
Reply