View previous topic :: View next topic |
Author |
Message |
Danny Guest
|
sizeof(const char *) and sizeof(rom char*) |
Posted: Fri Feb 05, 2010 7:50 am |
|
|
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*) |
Posted: Fri Feb 05, 2010 7:59 am |
|
|
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
|
|
Posted: Fri Feb 05, 2010 1:07 pm |
|
|
Anyone with an answer? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 05, 2010 2:21 pm |
|
|
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);
} |
|
|
|
|