www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: What's C's biggest mistake?

reply Mike James <foo bar.com> writes:
Walter Bright Wrote:

 http://www.reddit.com/r/programming/comments/ai9uc/whats_cs_biggest_mistake/

I write a lot of embedded C for microcontrollers. It would be great to have an easy means of accessing bytes in an int or short without having to resort to messy unions. Maybe make it a bit more BCPL :-) -=mike=-
Dec 27 2009
parent Teemu Pudas <tpudas cc.hut.fi> writes:
On 27/12/2009 20:29, Mike James wrote:
 It would be great to have an easy means of accessing bytes in an int or short
without having to resort to messy unions.

Don't do that. It's undefined behaviour. Yes, I've been bitten by it.
Dec 27 2009