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 CCS Technical Support

Looks like a bug in the compiler

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



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

Looks like a bug in the compiler
PostPosted: Fri Aug 13, 2004 11:34 am     Reply with quote

Here are the 2 snippets of code, and each produces a compile error:

Code:

struct structDateTime
{
   int8  iDay;       // day of month
   int8  iMonth;     // month
   int16 iYear;      // year
   int8  iHour;      // hour
   int8  iMinute;     // minute
   int8  iSecond;    // seconds (future use)
}

int   control_err;    //COMPILE ERROR: Expecting an identifier


Code:

struct structDateTime
{
   int8  iDay;       // day of month
   int8  iMonth;     // month
   int16 iYear;      // year
   int8  iHour;      // hour
   int8  iMinute;     // minute
   int8  iSecond;    // seconds (future use)
};         // NOTE THE SEMICOLON

int   control_err;    //No error
// more declarations
int16 g_iTreatCount;   
structDateTime sNow;  //COMPILE ERROR: Expecting a (

void self_test();
// more prototypes...
// function definitions...
// main()



Looks loke a bug in the compiler to me.

Nick
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Aug 13, 2004 11:39 am     Reply with quote

Forgot to mention that I'm using version 3.187

Nick
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Aug 13, 2004 11:58 am     Reply with quote

Okay, here's the workaround

Code:

typedef struct
{
   int8  iDay;       // day of month
   int8  iMonth;     // month
   int16 iYear;      // year
   int8  iHour;      // hour
   int8  iMinute;     // minute
   int8  iSecond;    // seconds (future use)
}  structDateTime; 
structDateTime sNow;   
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 13, 2004 11:59 am     Reply with quote

I don't think the semi-colon at the end is optional.
Look at this article in MSDN:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/decla_16.asp
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 13, 2004 12:00 pm     Reply with quote

Brush up on your C

struct structDateTime sNow;

Or either create a typedef
AlanH
Guest







PostPosted: Sun Aug 15, 2004 3:28 am     Reply with quote

C for Dummies is your friend
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