• 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: (Newbie) Debugger and Unsigned char x = 0;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Newbie) Debugger and Unsigned char x = 0;


  • Subject: Re: (Newbie) Debugger and Unsigned char x = 0;
  • From: Chris Espinosa <email@hidden>
  • Date: Thu, 2 Jun 2005 13:37:08 -0700

On Jun 2, 2005, at 11:41 AM, Chris Outwin wrote:

I'm using Xcode 1.5 on Mac OS X 10.3.9 to make an Objective-C, doc app.


My question is how do you get the debugger display zero as 0x00 for a dereferenced pointer to an unsigned char.


I am reassigning values in memory created by CFDataCreateMutable(kCFAllocatorDefault, totalBytes);  The debugger prints hexadecimal code for values 1 to 255 fine, but when it reaches a zero value it does different things.  Here's some examples of what I've tried.


*ptr = (unsigned char)0;        // The debugger prints nothing

*ptr = 0x00;                // The debugger prints nothing

*prt = 0;                    // The debugger prints nothing



*ptr = '0';                    // The debugger prints 0

*ptr = '\0x00';                // The debugger prints 0


Are the the zero values displayed in the summary view really 0x00?


What is the type declaration for ptr?  

When you say "the debugger prints", what do you mean?  Are you looking at the Value column in the Xcode debugger GUI?  Or are you trying to print a dereferenced pointer in the gdb console window?

When you say 'zero', do you mean the numerical value zero, or the ASCII character for zero ('0')?

Are you aware that in the C language family, text strings are terminated by a zero byte, so a char * whose first value is 0x00 is an empty string?

What do you think the compiler interprets '\0x00' as?

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >(Newbie) Debugger and Unsigned char x = 0; (From: Chris Outwin <email@hidden>)

  • Prev by Date: (Newbie) Debugger and Unsigned char x = 0;
  • Next by Date: Header paths
  • Previous by thread: (Newbie) Debugger and Unsigned char x = 0;
  • Next by thread: Header paths
  • Index(es):
    • Date
    • Thread