• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Corrupted NSMutableString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Corrupted NSMutableString


  • Subject: Re: Corrupted NSMutableString
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Sun, 3 Aug 2003 11:51:20 +0100

On Sunday, August 3, 2003, at 10:31 am, Mike Kluev wrote:

On 02/08/2003 21:58, "Alastair J.Houghton" <email@hidden> wrote:

On Saturday, August 2, 2003, at 03:30 pm, Matthew wrote:

Since the binary file's definition uses 2-byte short integers (for this
section), I'm kind of stuck. Since C defines short integers as being
two bytes, it "should" not be a problem.

No, it doesn't. C defines:

char is 1 byte

I believe it is only specified that "sizeof(char) = 1" and that
char should be able to represent the integer number in the range
-127 .. +127 (if signed) or 0..+255 (if unsigned). E.g. char can
be 20 bits.

Actually the C standard does, as I originally said, defines char in terms of the "byte". It also says that a "byte" is at least 8 bits in size, is the minimum addressable unit on the machine and can hold any member of the basic character set of the execution environment (see 3.4, 3.5, 5.2.4.2.1 in the C99 spec). So yes, char can be 20 bits, but only if one byte is also 20 bits.

<rant>
IMHO it isn't worth fussing about the possibility of char and byte being anything other than 8 bits; whilst some legacy equipment had unusual sizes (like 9 bit bytes), it is highly improbable that anyone designing a new machine would even consider bytes of other than 8 bits, since such a machine would be incompatible on a fairly fundamental level with almost every system operating today. Not to mention the fact that it'd give the hardware designers some really unpleasant headaches when they tried to use standard off-the-shelf components, many of which are set-up for machines with 8-bit bytes.
</rant>

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Corrupted NSMutableString
      • From: Mike Kluev <email@hidden>
References: 
 >Re: Corrupted NSMutableString (From: Mike Kluev <email@hidden>)

  • Prev by Date: Re: beginning C part 2
  • Next by Date: Re: [Newbie] mem errors cont.
  • Previous by thread: Re: Corrupted NSMutableString
  • Next by thread: Re: Corrupted NSMutableString
  • Index(es):
    • Date
    • Thread