To what extent does the system endianness effect a program. I know that doing pointer assignment will be affected, and unions are too, but what about bitshift operators? Do they apply to the value, merely emulating real bitshifts, or do they apply to the bits themselves? Are there any other cases where endianness should be taken into account?
Labdabeta
182
Posting Pro in Training
Featured Poster
Recommended Answers
Jump to PostEndianness only matters when you make an assumption about how bytes are organized. Bitwise operators will work with the value and have consistent behavior regardless of the endianness of the system, and that's one way to ensure portable code when sending or receiving binary data:
#include <algorithm> …
All 2 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Labdabeta
182
Posting Pro in Training
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.