View previous topic :: View next topic |
Author |
Message |
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
Pointers to bits are not permitted |
Posted: Fri Feb 25, 2011 2:35 pm |
|
|
Hi There,
I created a function that would be called by reference but I get Pointers to bits are not permitted and if wanna pass the address of a value, i get BIT variable not permitted here - is there any way around that so I still can utilize my function? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 25, 2011 2:42 pm |
|
|
Post a very short program that can be copied-and-pasted into an MPLAB
project, that can be compiled (except for the error). Example of a short
test program for pointers:
http://www.ccsinfo.com/forum/viewtopic.php?t=40749&start=2
Try to make your program be shorter.
Also post your compiler version. |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Fri Feb 25, 2011 2:52 pm |
|
|
PCM programmer wrote: | Post a very short program that can be copied-and-pasted into an MPLAB
project, that can be compiled (except for the error). Example of a short
test program for pointers:
http://www.ccsinfo.com/forum/viewtopic.php?t=40749&start=2
Try to make your program be shorter.
Also post your compiler version. |
Absolutely minimized that would be this:
Code: |
void MyFunction(int1 *test)
{ return; }
void main() {
int1 test;
MyFunction(&test);
} |
And it doesn't work if you change int1 test to int1 *test and the call to MyFunction(test); either...
Oh, using 4.119 by the way. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 25, 2011 2:57 pm |
|
|
The CCS manual says this:
Quote: |
Pointers to bits are not permitted
|
Post a description of why you want pointers to bits. In other words, what
do the bits represent ? |
|
|
cerr
Joined: 10 Feb 2011 Posts: 241 Location: Vancouver, BC
|
|
Posted: Fri Feb 25, 2011 2:59 pm |
|
|
PCM programmer wrote: | The CCS manual says this:
Quote: |
Pointers to bits are not permitted
|
Post a description of why you want pointers to bits. In other words, what
do the bits represent ? |
I read that as well but it didn't go into my little brain that I might just replace int1 with int8 to make it work (that's what I did now)... thanks for the kick! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Feb 26, 2011 6:19 am |
|
|
The reason for the restriction is quite simple.
Pointers are representing the base address of a data memory object. Up to eight Int1 bits are arranged at a single byte address, so the byte address doesn't allow to select it uneqivocally. If you want to apply pointers to a logical value, you have to use int8. |
|
|
|