CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

how is malloc defined for you?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

how is malloc defined for you?
PostPosted: Wed Aug 30, 2006 8:23 am     Reply with quote

In stdlibm.h, how is malloc defined for you? IE. what parameter? For me, it is

Code:
char *malloc(size_t size)


Since size_t is 8bits, wont a call like:

Code:
malloc(256)


result in 0 bytes being allocated? If I change the parameter to be an int16, I think this will cause problems, any other ideas? Basically, I'm talking to flash memory which has a page size of 256 bytes.



thanks
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

PostPosted: Wed Aug 30, 2006 5:58 pm     Reply with quote

I suppose that, what I meant to say is that 256 = 0xFF + 1 which equals 0 when dealing with only the first 8 bits. I found an old thread that CCS responded to saying to change the size_t operator to long from int (in stdlib.h). Won't this have ramifications with other libraries and other code in the C compiler?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group