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

  • Home
  • SEARCH
  • 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 8860469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:16:25+00:00 2026-06-14T15:16:25+00:00

uint8_t *bufferPtr=NULL; size_t bufferPtrSize=0; bufferPtr=malloc(bufferPtrSize * sizeof(uint8_t)) I have used this same code in

  • 0
 uint8_t *bufferPtr=NULL;
 size_t bufferPtrSize=0;
 bufferPtr=malloc(bufferPtrSize *  sizeof(uint8_t))

I have used this same code in File1.m it is working fine. When I am using this on File2.mm it is giving me assigning to 'uint8_t *' (aka 'unsigned char *' ) from incompatible type 'void *'error.

  • 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-06-14T15:16:26+00:00Added an answer on June 14, 2026 at 3:16 pm

    This is because .mm files aren’t treated as normal Objective-C files but as Objective-C++ files, so the type rules of C++ apply here. In C++, if you decide to have a type (in this case you have a void pointer) and then want another type (in your case a char pointer), then you have to explicitly cast them. The way to do this is static_cast<T>() where T is the target type. Ie: uint8_t *bufferPtr = static_cast<uint8_t *>(malloc(bufferPtrSize * sizeof(uint8_t)));

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

Sidebar

Related Questions

I have this code: bool CBSocketConnect(uint64_t socketID,uint8_t * IP,bool IPv6,uint16_t port){ // Create sockaddr_in6
I currently have this code: static void func( uint8_t var ); static volatile uint8_t
uint8_t * const LCDMem = (uint8_t *) &LCDM3; This code is used in msp430fg4618
I have the following code: const uint8_t HEADER_SIZE = 0x08; std::vector<uint8_t> a, b; uint8_t
Why doesn't this piece of code result in y == 0x100 ? uint8_t x
I have the following code: main() { uint8_t readCount; readCount=0; countinfunc(&readCount); } countinfunc(uint8_t *readCount)
I have a couple uint8_t arrays in my c code, and I'd like to
The fletcher16 source code is given like this on wikipedia . uint16_t Fletcher16( uint8_t*
I have following piece of code: typedef uint8_t array_t[8]; static array_t _my_array; static const
I'm working with legacy embedded C code which defines the types uint8_t, uint16_t and

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.