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

"byte" data type

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







"byte" data type
PostPosted: Sun Mar 30, 2003 1:58 pm     Reply with quote

I am presently evaluating CCS PCW for use in a project. I am having difficulty finding a documentation reference to the following statements:

byte k=5;
byte const weeks=52;

I assume that the first declares a byte of memory labeled "k" a value of 5, and the second declares a constant labeled "weeks" a value of 52. My problem is I can't find any reference to "byte" as a data type in the compiler documentation.


Also, the following code generates an error [38]:

typedef int byte;

This is verbatum from the mauual, (page 53), but when I compile it, I get an error "expecting identifier" with a marker between the "e" and ";" at the word byte. Again, I have been unable to find areference in the docs.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13239
R.J.Hamlett
Guest







Re: "byte" data type
PostPosted: Sun Mar 30, 2003 2:34 pm     Reply with quote

:=I am presently evaluating CCS PCW for use in a project. I am having difficulty finding a documentation reference to the following statements:
:=
:= byte k=5;
:= byte const weeks=52;
:=
:=I assume that the first declares a byte of memory labeled "k" a value of 5, and the second declares a constant labeled "weeks" a value of 52. My problem is I can't find any reference to "byte" as a data type in the compiler documentation.
:=
:=
:=Also, the following code generates an error [38]:
:=
:= typedef int byte;
:=
:=This is verbatum from the mauual, (page 53), but when I compile it, I get an error "expecting identifier" with a marker between the "e" and ";" at the word byte. Again, I have been unable to find areference in the docs.

Byte does not exist as a default type in CCS C. However it is defined using a #define, in all the include files for the different processors.
Generally, the include file for the processor you intend to use, forms an essential part of the documentation in this C, since it includes definitions like this, and also the values used by several of the functions.
Now in your final line (the typedef), 'byte', since it is a define, not a typedef, will get expanded by the compiler into the word 'int', and the line becomes:

typedef int int;

Which syntactically causes a recursion, and will give problems...

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 13240
Dave Hills
Guest







Re: "byte" data type
PostPosted: Sun Mar 30, 2003 3:19 pm     Reply with quote

Yes, Thank You!

A quick look at the device header file makes this all quite clear.

Thanks Again!!
___________________________
This message was ported from CCS's old forum
Original Post ID: 13242
R.J.Hamlett
Guest







Re: "byte" data type
PostPosted: Mon Mar 31, 2003 2:03 am     Reply with quote

:=
:=
:=Yes, Thank You!
:=
:=A quick look at the device header file makes this all quite clear.
:=
:=Thanks Again!!
I think the CCS manual, should really have a 'leader' page, saying that you should have print out/use the header file in conjunction with it. Unfortunately, this is not given, and so this sort of problem is common...

Good Luck.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13244
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