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

The uses of the __LINE__ operator

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



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

The uses of the __LINE__ operator
PostPosted: Mon Jul 17, 2006 11:16 am     Reply with quote

Hi,

I am trying to run the protothread samples from:

http://www.sics.se/~adam/pt/

It uses the __LINE__ operator to set a variable like:

Long a;
a = __LINE__;

But the compiles does not expand it and generates an error about the unknown identifier.

Is this correct and it must be only used in defines and print?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 17, 2006 12:08 pm     Reply with quote

It works with PCM vs. 3.249. Here is the ASM code from the .LST
file for the program shown below.
Code:

0000            00302 ....... a = __LINE__; 
000C 1283       00303 BCF    03.5   // Bank 0
000D 01A2       00304 CLRF   22    // MSB = 0
000E 300A       00305 MOVLW  0A
000F 00A1       00306 MOVWF  21   // LSB = 0x0A  (line 10)

Code:

#include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

//=================================
main()
{
Long a;

a = __LINE__;

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