I am trying to allocate data in the memory and store the pointer in a variable:
int * unsafe pdata = (int *)calloc(1, sizeof(int));
But I always get a warning like this:
C36258: pointer cast to type of larger alignment
Which alignment is used in xc, and how do i implement malloc/calloc right?
to store a calloc in a pointer
-
- Member++
- Posts: 17
- Joined: Tue Sep 23, 2014 12:17 pm
-
- XCore Expert
- Posts: 589
- Joined: Wed Feb 29, 2012 10:03 am
That message is just a warning and, in this case, it is safe to ignore. The memory returned by calloc is 32bit aligned so the cast is safe.
For the benefit of others.Posting the answer in Q&A section, which has been resolved in the following post : http://www.xcore.com/forum/viewtopic.php?f=26&t=3048
For the benefit of others.Posting the answer in Q&A section, which has been resolved in the following post : http://www.xcore.com/forum/viewtopic.php?f=26&t=3048