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

This can’t be a feature. I’m somewhat outraged.

 
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

This can’t be a feature. I’m somewhat outraged.
PostPosted: Sat Jul 18, 2009 9:00 pm     Reply with quote

This can’t be a feature. This is either a bug or lack of feature.

I have a function with the following arguments:
Code:
void i2c_write_block(
   int8  iI2CAddr,    // [in] I2C address of the remote chip where the register resides
   int16 iRegAddr,    // [in] address of the register on the remote chip
   int8  iBytes,      // [in] number of bytes to write to the external chip
   int8* pVals)       // [in] pointer to the buffer to write the data from


Due to a coding error, I write a call to a function, which has the last 2 arguments swapped.
Code:
int8                 aiInBuff[i_BUFF_SIZE];  // buffer to receive the data from the EEPROM into

i2c_read_block(iI2CAddr, iCurrAddr, &aiInBuff[0], i_BUFF_SIZE);


Compiler should generate a compile-time error. Compiler didn’t catch it. I’m outraged. PICs with a CCS compiler is okay for a start, but soon it will be LPC2000 with IAR compiler. As Gorby used once said about perestroika: “The process is underway” **.

** M.S. Gorbachev “Процесс пошел!”
_________________
Read the label, before opening a can of worms.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

may I be philosophical for a moment ?
PostPosted: Sun Jul 19, 2009 1:22 am     Reply with quote

I am not going to comment on the compiler not warning you.

I would merely say that you must be a very young man (I am 60).

You may have a reason to be disappointed, but keep your outrage for real problems in life, or you wont make it through to the other side.

Mike
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Jul 19, 2009 2:12 am     Reply with quote

You are complaining about lack of type checking in CCS C?

According to most C-standards, type checking is optional, so missing type checking surely isn't a bug. I agree, that type checking can help to avoid some simple coding errors.

When using compilers that involve extensive type checking, e.g. embedded Visual C, I found, that the most nasty coding errors are not detected by type checking anyway...

I don't remember a particular coding error in CCS C work, that would have been avoided by more type checking, but there may be some. In my opinion, it's a less important in CCS C features.
Ttelmah
Guest







PostPosted: Sun Jul 19, 2009 8:43 am     Reply with quote

The key is to understand that C itself, is not a 'strong typed' language. It has built in, automatic casting of values to the required type, if possible, as they are passed to/from functions. This makes it perefectly possible, and acceptable, to pass an integer, to a function expecting a pointer, and the integer, will be used as a pointer when passed, without complaint. This behaviour, is potentially dangerous, _but is part of C_. I can do this, on an old Unix C, and it works fine...
It is a powerful ability, but also potentially dangerous.
This behaviour was changed, with latter variants, with ANSI C increasing the checking, and things like C++, making casts obligatory, to reduce the risks.
If you want stronger checking, then use a separate syntax checker. Many people here do exactly this, passing the code through third party checkers, before doing the final compilation.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jul 19, 2009 8:51 am     Reply with quote

I do understand it is very annoying to waste time searching for a bug that the compiler could have easily warned you for. But, it is a missing feature, not a bug.

At my work we are using the same code base to compile for three different OS-es and it is surprising to see how each compiler warns against different bad coding practices. The IAR compiler might be better than CCS, but be assured you will find missing features here as well.

Send an email to CCS to ask for this missing feature to be added. Only features asked for by customers will be implemented. If you don't think it worth to send an email, than it is not worth complaining either.
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

OK, leave the guy alone now
PostPosted: Sun Jul 19, 2009 9:08 am     Reply with quote

OK, we have flamed him enough.

Finally, the other important point is the cost.

The CCS compiler is $250 or so.

The cheapest IAR for ARM is the one below, the most expensive being £3,000+

IAR Baseline Embedded Workbench for ARM - 256KB Code Limited

As for Embedded Workbench for ARM except MISRA C Checker, Design tools and Printed User Guides are not included. Support not included - support is charged at £300 for 12 months.
Price: £1,580.00 / €1,738.00

We accept the limitations and quirks with CCS for the low cost compiler, and this brilliant forum.

Mike
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

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

PostPosted: Sun Jul 19, 2009 6:13 pm     Reply with quote

FvM wrote:
You are complaining about lack of type checking in CCS C?

According to most C-standards, type checking is optional, so missing type checking surely isn't a bug. I agree, that type checking can help to avoid some simple coding errors.


You need to take this problem up with Kernighan and Richie. This is the reason Nicklaus Wirth designed Pascal.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

better yet no type required
PostPosted: Mon Jul 20, 2009 7:56 am     Reply with quote

back when i was using training wheels - i recall True Basic - which has
only two types to check - string or numeric - where ANY numeric is internally converted to whatever you need for a given calculation - integer to IEEE float - signed or unsigned - makes no never mind - and the first use of a data item initializes it.

strings were limited to 64Kb each - with no zero tag - - instead using an
unsigned int16 preceding the string data and if you are a primitive user you did not have to know about that either since the only access to the headers was through 808x ASM anyway.

i still use it when i want to prototype a hi level math intensive routine in a hurry - because it is SIMPLE ,accurate and foolproof - even for a 60++ year old.

of course , that required a heck of a lot of overhead such that hello world , when compiled - carried 100k of executive baggage.

too bad there is no PIC version
Laughing
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

Re: OK, leave the guy alone now
PostPosted: Wed Jul 22, 2009 9:01 pm     Reply with quote

MikeW wrote:

We accept the limitations and quirks with CCS for the low cost compiler, and this brilliant forum.


Ya know, it's interesting that I did a project in C18 from Microchip... and when I converted it to CCS because of what a pain some of the C18 quirks gave me, I got back about 30% of my program space and was able to implement all my features without changing the micro to a bigger device.

I've looked at the ASM code CCS generates and in a lot of cases, it's not too bad. I've done my share of hand-tuning ASM in CCS for speed -- but not too often. They've got a lot of nice optimization in there...

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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