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

enum compiler bug or poor programmer?

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



Joined: 03 Oct 2004
Posts: 2

View user's profile Send private message

enum compiler bug or poor programmer?
PostPosted: Sat Nov 13, 2004 12:16 pm     Reply with quote

Hi,

I think I found a bug in the compiler. I'm using version 3.184. When I run this code, I get the compiler error"Expecting a , or )". However, if I place in comment the function prototypes (which are optional here), the compiler detects no error. If I keep the prototypes, but change the function enum parameters for int1, I get no error too.

Is this really a bug or am I a crazy?

Here's my code:

#include <18f458.h>
#fuses HS,NOLVP,NOWDT,PUT
#use delay(clock=8000000)
#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#define BATTERY_FOR_5V_STAT_PIN PIN_A2
#define BATTERY_FOR_5V_HDQ_PIN PIN_A3
#define BATTERY_FOR_12V_STAT_PIN PIN_A1
#define BATTERY_FOR_12V_HDQ_PIN PIN_A4

enum EBatterySource {eBatteryFor5V, eBatteryFor12V};

// function prototypes which to place in comment
void OutputHDQ(EBatterySource eBatterySource, int1 nBitToSend);
int1 InputHDQ(EBatterySource eBatterySource);

void OutputHDQ(EBatterySource eBatterySource, int1 nBitToSend)
{
if(eBatterySource == eBatteryFor5V)
{
if(nBitToSend == 1)
output_high(BATTERY_FOR_5V_HDQ_PIN);
else
output_low(BATTERY_FOR_5V_HDQ_PIN);

} else if(eBatterySource == eBatteryFor12V)
{
if(nBitToSend == 1)
output_high(BATTERY_FOR_12V_HDQ_PIN);
else
output_low(BATTERY_FOR_12V_HDQ_PIN);

} else
{
printf("Error in OutputHDQ(): eBatterySource = %d\r\n", eBatterySource);
}
}

int1 InputHDQ(EBatterySource eBatterySource)
{
if(eBatterySource == eBatteryFor5V)
{
return input(BATTERY_FOR_5V_HDQ_PIN);

} else if(eBatterySource == eBatteryFor12V)
{
return input(BATTERY_FOR_12V_HDQ_PIN);

} else
{
printf("Error in InputHDQ(): eBatterySource = %d\r\n", eBatterySource);
}
}

main()
{
while(1)
{
OutputHDQ(eBatteryFor5V, 0);
input(eBatteryFor5V);
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Nov 13, 2004 1:36 pm     Reply with quote

By default, the compiler is not case sensitive.
You can enable it by adding the line shown below, in bold.
However, I would never use identifers which differ only
by case. It's just too error prone.

#include <18f458.h>
#fuses HS,NOLVP,NOWDT,PUT
#use delay(clock=8000000)
#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#case // This turns on case sensitivity
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