Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
pre-processor __LINE__ not working ?
Posted: Sun Sep 09, 2007 10:37 am
I have been trying to use __LINE__ to report the current line to help with my debugging.
However PCM 3.249 gives the error :
Line 1375(16,17): Expecting LVALUE such as a variable name or * expression ::
for the following line of code :
printf(__LINE__) ;
if I replace with
printf(__FILE__) ;
its ok ?
Indeed the example given in help file don't work either, CCS says it too long ie :
printf("Too many entries, source file: " __FILE__ " at line " __LINE__ "\r\n");
Whats going on ?
Neil
nurquhar
Joined: 05 Aug 2006 Posts: 149 Location: Redditch, UK
Posted: Sun Sep 09, 2007 12:11 pm
Would you believe it, the CCS PCM Documatation is wrong !
__LINE__ is not type char* but long.
Thus to print your line number you actually need to use something like this :
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