Jump to content
Sign in to follow this  
Tony

Is There An Issue With Pointer Arithmetic In 6.97?

Recommended Posts

Hi -

I'm using SB C v6.97 compiling for a PIC16F1933. I have written an implementation of K&R's memory allocator but it seems to have an issue with pointer arithmetic, and throws the following errors: File is attached.

..\util.c(57): error: illegal operation for operands 'unsigned char' and 'header*'
..\util.c(57:4): error: failed to generate expression
..\util.c(91:9): error: failed to generate expression
..\util.c(91:9): error: invalid operand '+ '
..\util.c(91:20): error: failed to generate expression
..\util.c(101:8): error: failed to generate expression
..\util.c(101:8): error: invalid operand '+ '
..\util.c(101:19): error: failed to generate expression

...

I have tried simplifying some of the expressions but to no avail.

Cheers,
Tony.

util.c

Share this post


Link to post
Share on other sites

p += p->size; is the complaint.<br /><br />You might try helping the compiler out by doing some type casting.<br /><br />Also, I think SourceBoostC comes with a malloc library that you could use.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×