Jump to content

Tony

EstablishedMember
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by Tony

  1. 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: in
  2. You are correct, accepted syntax doesn't appear to be as one would expect, I've added it to our bug list to get fixed. You can ignore this warning. It just means that the debug file (coff file) can't represent the function pointer data type. All this means is that you won't be able to watch the pointer values in the debugger. The way function pointers are implemented in BoostC is that the function pointer has a simple value, that value is an index into a jump table where the function arguments are patched, then the actual function is called. On return the return value is patched up and t
  3. Hi Dave - Thanks again for your help. Dropping the brackets made my code compile, although this is not how K & R describe using function pointers. I'm still getting the warnings mentioned before, though, "Coff generation: Internal Warning: Member Var:cmdFunc Unrecognised type id:0x10000BBD" and looking at the assembler generated I am not confident the correct values are being written into the array for the function pointers. I can see the ASCII for the strings and the string terminator followed by a single byte that increases in value (from 0x01) for each entry in the array. Any
  4. You have probably done made the same mistake I did when trying to compile your code: #define CMD_STR_MAX_LEN 1; typedef struct cmd_S { void ( *cmdFunc )( char * cmdLinePt ); char cmdStr[ CMD_STR_MAX_LEN ]; } cmdStruct; void main() { } Notice the mistake? There is a semi colon where it shouldn't be, at the end of "#define CMD_STR_MAX_LEN 1;". Removing that allows successful compilation for me. Regards Dave Hi Dave - Thanks for your reply. It turns out that this wasn't the problem (although I did remove it thanks ) because if I comment out the function pointer l
  5. Hi - I am running an older version of BoostC (v.6.81) as this is what my work has purchased. I am trying to add a function pointer to a structure but the compiler gives a "Missing right brace" error. As far as I can see there is nothing wrong with the code. Is this a limitation with this version of the compiler? The manual says "pointers can be used in the standard way". The code below is situated in a header file. typedef struct cmd_S { void ( *cmdFunc )( char * cmdLinePt ); char cmdStr[ CMD_STR_MAX_LEN ]; } cmdStruct; Cheers, Tony.
×
×
  • Create New...