c - Static analyser to detect two post/pre increment operators -


i have huge code base. has statement shown below:

int = ( (unsigned int) ((unsigned char) buffer[offset++]) << 8) | (unsigned int) (unsigned char) buffer[++offset]; 

recently migrated higher version of compiler. compiler migration, evolution of complex statements shown above resulted in inconsistent results.

i know bad coding practice , want correct it. looking static analyser can flag these errors. pointers perticular static analyser appreciated.

it's not bad coding practice.

it's dreadful. introducing absolute truck load of undefined behaviour program.

|, unlike ||, not sequencing point. increasing offset twice, conceptually @ same time. c standard not define behaviour.

you need fix immediately. shelve static analyser now. compiler warning flag suite might able you. if in position, i'd in panic mode , i'd search code base ++ , --, , check every expression.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -