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 support@ccsinfo.com

Pointers to bits are not permitted

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

Pointers to bits are not permitted
PostPosted: Fri Feb 25, 2011 2:35 pm     Reply with quote

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? Mad
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 2:42 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 2:52 pm     Reply with quote

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... Sad
Oh, using 4.119 by the way.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 2:57 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 25, 2011 2:59 pm     Reply with quote

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! Embarassed
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Feb 26, 2011 6:19 am     Reply with quote

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.
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