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 7850225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:47:11+00:00 2026-06-02T18:47:11+00:00

in my function I allocate memory for and fill a structure called messagePacket struct

  • 0

in my function I allocate memory for and fill a structure called messagePacket

struct messagePacket *packet = malloc(sizeof(struct messagePacket));
//fill

When I try to cast the pointer as a (uint8_t *), gcc throws a warning that says: large integer implicitly truncated to unsigned type

sendBuf(..., (uint8_t *)packet);

I’ve been able to do the following just fine, and I understand I can use this approach as a workaround. I’m here because I would rather learn from this than work around it.

uint8_t *buf = malloc(sizeof(struct messagePacket));

The size of struct messagePacket = 1209 B. My best guess is that the chunk of memory is super large that I gets stored in a high memory address, such as a 16 bye address? But that doesn’t fit with the fact that I can malloc a uint8_t * of the same size.

  • 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-02T18:47:11+00:00Added an answer on June 2, 2026 at 6:47 pm

    I think the warning is about some other argument. Please provide the full code for that line, the prototype for the sendBuf() function, and the full compiler warning for the line in question.

    As a general idea, the sendBuf() function should probably use a const void * rather than a const uint8_t * for the data to send. See send() and friends.

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

Sidebar

Related Questions

I want to pass a pointer to pointer to a function, allocate memory in
I want to allocate memory and fill it to the pointer, that are one
I would like to dynamically allocate memory from the machine_init function in my arm
Which is preferable way to allocate memory for a function that is frequently allocating
if this is a bad idea, how to allocate memory in the function?
I have to allocate a struct from within another function, obviously using pointers. I've
I need help with malloc() inside another function . I'm passing a pointer and
Using C, is there a safer way to allocate memory than using malloc? For
I'm trying to figure out how to allocate memory for a struct in SPARC
Im allocating memory to a double pointer in another function, therefore I need to

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.