View previous topic :: View next topic |
Author |
Message |
SeeCwriter
Joined: 18 Nov 2013 Posts: 160
|
Case Sensitivity |
Posted: Thu Feb 26, 2015 9:42 am |
|
|
I was curious of anyone here had ever enabled case sensitivity and what the results were. Did any of the built-in libraries have problems? Did it cause lots of extra work?
I really would like the code to be case sensitive, as C is supposed to be, but the warnings in the manual that CCS libs are not tested with case sensitivity enabled scares me.
If you enable case sensitivity with #CASE, the stream identifiers are no longer recognized, even if they are the same case.
Code: |
#CASE
#USE RS232( BAUD=9600, STREAM=com1 );
...
val = fgetc( com1 ); // <-- ERROR: Undefined identifier
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Thu Feb 26, 2015 1:43 pm |
|
|
You should have pins or a UART selected, but the reason is that stream names _must_ be capitals, if case is selected.
You will see that all example stream names are capitals only. The #USE RS232 function defaults to treating all text internally as capitals.
So this:
Code: |
#CASE
#USE RS232(UART1, BAUD=9600, STREAM=com1)
//or
#USE RS232(UART1, BAUD=9600, STREAM=COM1)
void main()
{
int8 val;
val = fgetc(COM1);
}
|
Will work. |
|
|
SeeCwriter
Joined: 18 Nov 2013 Posts: 160
|
|
Posted: Thu Feb 26, 2015 6:17 pm |
|
|
That fixed it. Thanks. So far I've run across no other issues. But it's early yet. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1345
|
|
Posted: Thu Feb 26, 2015 7:43 pm |
|
|
I've used #case almost my entire time using CCS. So far no issues with it at all. I think in general it is a good idea to turn it on. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Fri Feb 27, 2015 12:13 pm |
|
|
I must admit, the one I've had trouble with, is signed versus unsigned.
Had a couple of libraries give problems when I changed the default integer type. #case has given me no problems, except for the occasional 'oddity' like this one. |
|
|
|