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

function overload (second opinion needed)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9133
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 17, 2020 1:18 pm     Reply with quote

OK, I'm not a trained C programmer but the 1st program has 7 functions all called 'test'. When I started, variables could have a maximum of 2 characters as their name (A...ZZ ). Today you can have lots ! maybe 255 ? I don't know, never checked but many more than I care to type ! My point is you should not have similarly worded variables or names of functions. It can be confusing. Heck CCS uses the name 'char' to describe data from 00-255, same as an unsigned int8..so quick, will the compiler make them the same ,if the functions are named the same ? I don't know....
Then there's the 'it's CCS C NOT 'C' ' problem....
Ttelmah



Joined: 11 Mar 2010
Posts: 19255

View user's profile Send private message

PostPosted: Mon Feb 17, 2020 1:41 pm     Reply with quote

Yes, there are occasions where 'similar' types like this will confuse
overloading. Not in this case (since char is a signed int8, on a PIC24),
but it certainly can happen.

Thinking about it (and when I have seen this), I think it only happens
when the 'types', are not actually types, but are #defines.
If you look in the processor include file, there is a block like:

#define BYTE unsigned int8
#define BOOLEAN int1

Only normally a couple (there is a larger similar list for when you are not
using the CCS compiler). The ones defined here will 'confuse' the
overloading.

So if you have two functions, one using BYTE, and one using unsigned int8
then both will be seen as referring to the same type.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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