Subject: Re: [boost] [endian] endian flip and endian domain
From: Dave Handley (Dave.Handley_at_[hidden])
Date: 2010-06-08 13:05:18
Gottlob Frege wrote:
> I think what I am saying is that, conceptually at least, the
> endian-types come first, and the straight functions are built on top
> of that (instead of the other way around as most are suggested).
> Now, I wouldn't want that to impact performance, which is why I say
> 'conceptually'. We can specialize the heck out of everything so that
> performance wins, but I think the conceptual foundation is important.
I disagree. If you have an endian type then I think you are coding in from the beginning a need for a copy in order to endian swap - even if the endian swap is a no-operation. Unless I'm missing something here. I also don't think this is bad. Remember that endian swapping happens once at the boundary of the code. It isn't something that is constantly changing type and we shouldn't be worried about the programmer losing track of what type the data is in imho. Of course, if someone can come up with a typed interface which doesn't enforce a copy then I may change my mind.
Next, on naming, I think we should be very careful that we don't over-think the naming question. I'll ask a general question. What term does everyone use when talking about endian swapping? Certainly in my programming career I've never heard it called anything other than endian swapping. Also (and I know this shouldn't be taken as a definitive source) Wikipedia refers to the process of changing endianness as a byte swap. Shouldn't we use swap because that is what everyone knows the process of changing endianness as? That's my 2d, but I'm not wholly against another naming option.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk