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

sizeof(const char *) and sizeof(rom char*)

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







sizeof(const char *) and sizeof(rom char*)
PostPosted: Fri Feb 05, 2010 7:50 am     Reply with quote

int32 i;

i=sizeof(const char *) and

i=sizeof(rom char*)

My compiler has a problem evaluating these statements. It complains with the following message

A numeric expression must appear here. Please help
Guest








Re: sizeof(const char *) and sizeof(rom char*)
PostPosted: Fri Feb 05, 2010 7:59 am     Reply with quote

Danny wrote:
int32 i;

i=sizeof(const char *);

i=sizeof(rom char*);

My compiler has a problem evaluating these statements. It complains
A numeric expression must appear here. Please help


Just added semicolon to make things clear in the above. The compiler is version 4 PCH.
Danny
Guest







PostPosted: Fri Feb 05, 2010 1:07 pm     Reply with quote

Anyone with an answer?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 05, 2010 2:21 pm     Reply with quote

Quote:
The compiler is version 4 PCH.

Always give your full compiler version. See how many versions there are ?
http://www.ccsinfo.com/devices.php?page=versioninfo
Each one of those probably has several other things fixed besides what's
listed.

Always post your PIC. There must be hundreds of PICs. Each one is
different in silicon and in the compiler.

Quote:

int32 i;
i=sizeof(const char *) and
i=sizeof(rom char*)

My compiler has a problem evaluating these statements. It

Do we know that any of this works ? Here is CCS's announcement of
a feature regarding 'const' and pointers.
http://www.ccsinfo.com/content.php?page=compiler-features#pconst
But if I take their sample code and drop it into a test program such
as the one below, and compile it with vs. 4.104, what do I get ?
I get 13 error messages. So I repeat, do we know that any of these
new features work ? You wanted an answer. Well...
Only the features that you can test and prove as working, are the ones
that really work.
Code:

#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//======================================
void main(void)
{
const char version[] = "PRODUCT ID V1.01";
const char *ptr;

ptr = &version[0];

while(1);
}
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