Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!198.186.194.247.MISMATCH!news-out.readnews.com!transit3.readnews.com!postnews.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news3 From: Michael Wojcik Newsgroups: comp.lang.java.programmer Subject: Re: =?UTF-8?B?QW5kcm9pZOKAlFdoeSBEYWx2aWs/?= Date: Fri, 03 Jun 2011 17:14:52 -0400 Organization: Micro Focus Lines: 35 Message-ID: References: NNTP-Posting-Host: p5f4a9961b20217fc6a6b2a2caf706a6e368e719ac403b17d.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.5.0 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4953 BGB wrote: > > CHAR_BIT==8 is AFAIK more acceptable, since nearly all major/common > hardware at this point (and likely in the near future) has this property. It's acceptable right up until it isn't. And there are still a number of major embedded platforms which do not use 8-bit char. That said, it's often true that an explicit assumption that CHAR_BIT is 8 is acceptable. The problem is when that assumption isn't explicit, and the code might be ported to a platform where CHAR_BIT > 8. (The larger problem is the existence of C programmers who don't know about CHAR_BIT, or how C defines "byte".) > endianess matters if one thinks the code may have a chance of migrating > between different sorts of targets, such as between x86 and PPC. Since portability is the matter under discussion... > usually > I handle endianness in my own code though. Glad to hear it - though generally well-written C code should be endian-neutral, especially when marshalling and unmarshalling data that may not match the implementation's endianness. (That is, it should employ shifting and masking using unsigned integer types, which produces the correct result regardless of platform endianness.) What you do, or what I do, says nothing about what most C programmers do, however. And that was my point. -- Michael Wojcik Micro Focus Rhetoric & Writing, Michigan State University