|
From: Gordon H. <gor...@dr...> - 2009-11-16 10:18:44
|
On Mon, 16 Nov 2009, Raphael Neider wrote:
> Hi,
>
>> This (contrived example) fails to compile:
>>
>> void test (int data)
>> {
>> int i ;
>> i = data ;
>> }
>>
>> Compile command:
>>
>> sdcc -mpic16 -p18f4685 -c test.c
>>
>> Gives:
>>
>> test.c:5: syntax error: token -> 'data' ; column 10
>> test.c:6: error 159: in function test: name omitted for parameter 1
>>
>> Compiles fine with gcc, so wondering if 'data' is pre-defined as a
>> keyword somewhere?
>
> Yes, "data" is a memory space indicator (like code, idata, pdata,
> xdata, and more).
> You can compile with --std-c89, which defines only the variants
> __data, __code, __idata, __pdata, __xdata, ... as keywords and allows
> you to use the non-__-prefixed ones as regular identifiers.
Interesting.
Of-course, I've now found some references to it in the manual - problem
is, it's in the sections headed with other processor types and not in the
PIC16 section, so I'd not bothered to read it before...
My experiences so-far is that SDCC is a very capable PIC code generator,
my project's compiling to about 50KB of Flash and I've more to go yet...
it's just the documentation that's somewhat lacking.
I suspect that's just the way it's been over time, rather than by design!
Thanks,
Gordon
|