Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7578683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:29:25+00:00 2026-05-30T17:29:25+00:00

While walking through a sample code application for the iPhone, I found a pair

  • 0

While walking through a sample code application for the iPhone, I found a pair of send/receive methods that effectively had the same signature definitions, with the exception of the value types associated for one of the variables.

From within the header:

- (void)receivedData: (unsigned char *)data length:(NSUInteger)len;
- (void)sendData:     (uint8_t*)       data length:(NSUInteger) len;

These methods are used as wrappers for a sending/receiving process, which effectively is passing around a pointer to a byte array of data being written to and from data streams. I found these method signatures to be a bit curious and since I’m new to Cocoa/Cocoa Touch dev, I decided to check out the definition of the uint8_t type. I discovered that the uint8_t is defined as an unsigned char within stdint.h and, therefore, the data variables for these methods are exactly the same. At least, that is the case for the stdint.h that is being linked within XCode 4.2.

However, doing a bit of further research regarding the uint8_t type I found this question regarding uint8_t vs. unsigned char usage. The consensus seems to be that quite often these two value types are exactly the same but with some implementations of the C standard libraries, they might be different. Ergo, one should not trust that they will be the same type of data when generating portable code.

With that said, is it safe to assume from within an Apple/Objective-C programming environment that the uint8_t will be the same as an unsigned char or should I follow the same advice given within the above mentioned question?

This may seem like a picky question to ask, but since I may be integrating libraries where this type of coding mis-conduct appears to be a bit prevalent into a personal codebase that could be used in multiple, Apple environments (for quite a few years to come), I wanted further commentary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:29:26+00:00Added an answer on May 30, 2026 at 5:29 pm

    Ignoring questions of portability (as you have implicitly asked us to do), it seems exceptionally unlikely that char will ever be anything other than an eight bit value under Mac OS X and its derivatives such as iOS. I think you can safely assume that unsigned char and uint8_t will be the same forever.

    That said, I think as a form of documentation for the programmers to come after you, when you are dealing with a value meant to hold a byte of binary data and not a character, it seems smarter to use “byte” or “uint8_t” or some similar method of indicating to future readers that the intent of a function is to treat a value as a byte and not as a character per se.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While testing I started walking through authorizing my test machine (192.168.15.6, a local IP)
While going through university and from following the development of SO, I've heard a
I'm walking through Adam Kinney's Blend tutorials ( http://visitmix.com/labs/rosetta/EyesOfBlend/ ) and I'm seeing some
I found this site http://www.shutterfly.com/documentation/api_OrderImage.sfly but there are no examples of actually walking through
I was writing some C# code recursively walking the referenced assemblies of a base
Ok, I'm certainly familiar with walking through a table using a read-only cursor, but
in my app i need to draw lines on map while i am walking,running
I have a function that during execution while in the debuger runs both the
I'm developing an application with the MapView and the GPS. My problem is that
We recently came across some sample code from a vendor for hashing a secret

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.