Reply by Onestone July 10, 20052005-07-10
karldalen wrote:

>--- In msp430@msp4..., "Paul Curtis"
<plc@r...> wrote:
>  
>
>>Hi Karl, 
>>
>>    
>>
>>Swedish history?  Doesn't that start with ABBA?  ;-)
>>    
>>
>
>Most non sweeds tend to believe that ,yes! ;-)
>Then comes , meatballs,, Bjorn Borg and free sex! :-)
>  
>
>>I've only ever been to Linking.
>>    
>>
>Well, thats a start too!
>  
>
The swedes used to be one of the great military powers of Europe, and 
were a major Naval Power, until they sank their flag ship, they then 
became famous, long before ABBA, for selling modified tanks as family 
cars, for designing a military tank without aturret, so the gun couldn't 
traverse, and for damnded good beer. They were also famous for one of 
the great lines from Btirish comedy "Hi, I'm Inga from Sveden".
I've 
never heard of them as famous for meatballs, I thought that was mexicans 
and Italians, I that Bjorn had been assimilated by the Borg long ago, 
and in the 60's when I was an evil child, the brits, and danes were more 
into free sex than the swedes I knew.

Al

>  
>
>  
>


Beginning Microcontrollers with the MSP430

Reply by karldalen July 10, 20052005-07-10
--- In msp430@msp4..., "Paul Curtis" <plc@r...> wrote:
> Hi Karl, 
> 
> > --- In msp430@msp4..., Anders Lindgren 
<Anders.lindgren@i...>
> > wrote:
> > > Richard wrote:
> > > 
> > > >I will have to say that just on this list, Paul does seem to
> > answer more 
> > > >IAR questions than Ander :-)
> > > >  
> > > >
> > > 
> > > Yes, Paul seems to be a real IAR fan!
> > > 
> > > > Paul, send them a bill! :-)
> > > 
> > > 
> > > Or, better yet, hand deliver it -- I could take you on a tour-
de-
> > Uppsala 
> > > and show you everything there is to see in our little town 
(which, 
> > > honstely, isn't that much)... ;-)
> > 
> > Well, i woldent say that, take him to the grand church dome 
> > and educate him in swedish history, then take him to the old 
> > heights (viking graves) and fill him with mj! That would do it!
> 
> Swedish history?  Doesn't that start with ABBA?  ;-)

Most non sweeds tend to believe that ,yes! ;-)
Then comes , meatballs,, Bjorn Borg and free sex! :-)
> 
> I've only ever been to Linking.
Well, thats a start too!

REG
KD

> 
> --
> Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
> CrossWorks for MSP430, ARM, AVR and now MAXQ processors



Reply by Paul Curtis July 9, 20052005-07-09
Hi Karl, 

> --- In msp430@msp4..., Anders Lindgren
<Anders.lindgren@i...>
> wrote:
> > Richard wrote:
> > 
> > >I will have to say that just on this list, Paul does seem to
> answer more 
> > >IAR questions than Ander :-)
> > >  
> > >
> > 
> > Yes, Paul seems to be a real IAR fan!
> > 
> > > Paul, send them a bill! :-)
> > 
> > 
> > Or, better yet, hand deliver it -- I could take you on a tour-de-
> Uppsala 
> > and show you everything there is to see in our little town (which, 
> > honstely, isn't that much)... ;-)
> 
> Well, i woldent say that, take him to the grand church dome 
> and educate him in swedish history, then take him to the old 
> heights (viking graves) and fill him with mj! That would do it!

Swedish history?  Doesn't that start with ABBA?  ;-)

I've only ever been to Linking.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

Reply by karldalen July 9, 20052005-07-09
--- In msp430@msp4..., Anders Lindgren <Anders.lindgren@i...> 
wrote:
> Richard wrote:
> 
> >I will have to say that just on this list, Paul does seem to 
answer more 
> >IAR questions than Ander :-)
> >  
> >
> 
> Yes, Paul seems to be a real IAR fan!
> 
> > Paul, send them a bill! :-)
> 
> 
> Or, better yet, hand deliver it -- I could take you on a tour-de-
Uppsala 
> and show you everything there is to see in our
little town (which, 
> honstely, isn't that much)... ;-)

Well, i woldent say that, take him to the grand church dome and 
educate him in swedish history, then take him to the old heights
(viking graves) and fill him with mj! That would do it!

REG
KD 



Reply by rolf...@... July 8, 20052005-07-08
Hi,

in the rationale of C99 you can find that a char is a Byte and that a Byte has 8
Bit.
Due to the C99 limits.h int has at minimum 16 Bit, a long long int has at
minimum 64 Bit and 
so on, but i do prefer exact data types (uint8_t, ... int64_t, ...) to write
portable code.

Regards,

Rolf


msp430@msp4... schrieb am 08.07.05 22:27:56:
> 
> <snip>
> 
> >>
> >>void main ()
> >>{
> >>        char t;
> >>
> >>            for ( t=0; t<= 1000;t++){}     // Bad Lint! FOR 
> >>loop never ends!
> >>
> >>            while(1){}
> >>
> >>}// END MAIN
> >>
> >>For $2700 I would expected that not to happen :(
> >>    
> >>
> >
> >For $2700, you do:
> >
> >Remark[Pe236]: controlling expression is constant C:\Documents and
> >Settings\plc\My Documents\IAR Embedded Workbench\test.cpp
> >  
> >
> <Snip>
> Hi.
> 
> The whole discussion raised a question here: isn't char AT LEAST 8-bit
wide?
> I mean, it could be 16-bit wide and the above code would end, depending 
> on architecture (for example, C2000 TI DSP's don't have byte
addressing).
> If the above stated is true, how should the preprocessor know how long a 
> char is if that would be chosen by the compiler later on?
> 
> regards,
> Ricardo.
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 



Reply by Walter Banks July 8, 20052005-07-08
It is a time honored tradition of C that you have the
power to do unexpected things and shoot yourself
in the foot.

Lint and other diagnostic programs are to give you hints
about what might go wrong.

Compilers can do some diagnostics at the expense of
potentially reducing language functionality. What
should compilers do with

if ( a = b ) {  . . . }

w..

alex@alex... wrote:

>  Al, I disagree... No matter how you look to this
code, even from the
> perspective of quantum mechanics,
> this code is an ERROR! The intent of the FOR loop here is to terminate on a
> certain and well defined counter value.
> Otherwise the programmer leaves this field free, case in which the for loop
> becomes similar to a while loop.
>
>
> And they want an arm and a leg for their mediocre product!
>
> Alex
>





Reply by Ricardo Wiggers July 8, 20052005-07-08
<snip>

>>
>>void main ()
>>{
>>        char t;
>>
>>            for ( t=0; t<= 1000;t++){}     // Bad Lint! FOR 
>>loop never ends!
>>
>>            while(1){}
>>
>>}// END MAIN
>>
>>For $2700 I would expected that not to happen :(
>>    
>>
>
>For $2700, you do:
>
>Remark[Pe236]: controlling expression is constant C:\Documents and
>Settings\plc\My Documents\IAR Embedded Workbench\test.cpp
>  
>
<Snip>
Hi.

The whole discussion raised a question here: isn't char AT LEAST 8-bit
wide?
I mean, it could be 16-bit wide and the above code would end, depending 
on architecture (for example, C2000 TI DSP's don't have byte
addressing).
If the above stated is true, how should the preprocessor know how long a 
char is if that would be chosen by the compiler later on?

regards,
Ricardo.


Reply by Onestone July 8, 20052005-07-08
alex@alex... wrote:

>Al, I disagree... No matter how you look to this
code, even from the
>perspective of quantum mechanics,
>this code is an ERROR! The intent of the FOR loop here is to terminate on a
>certain and well defined counter value.
> Otherwise the programmer leaves this field free, case in which the for loop
>becomes similar to a while loop.
>
I'm NOT talking semantics, and I can't see the referecne to
quantum 
mechanics here. THE COMPILER CANNOT READ YOUR INTENT. C allows this 
statement. It is crappy programming style I'd suggest, but according to 
C it is NOT AN ERROR> Now I'm not a standards guru, or fanatic, I'm

certain paul, Anders, Rolf , Michel , Richard, Jon K, Kris and the many 
othes out there who seem to have every version of the C standard 
memorised will jump in and beat me up if I'm wrong, but I have written a 
damned lot of C, and many many moons ago studied Kernigan and Ritchie 
very thoroughly (In fact I consider that to be the real C standard, the 
rest is just a committee mouse.) If you want to be dumb C allows this. 
It's one of its best features in my opinion.

>Also. We need to be very cautious when we use the
word "Compiler". In the
>strictest sense of the word
>and according to K&R the Compiler it self has no error checking
facilities
>at all. This is not it's job.
>The Compiler's duty is to take the source code and transform it in an
>intermediate file that is
>acceptable by the next processing step. This is all! No error checking here.
>
hence no error to be disclosed.

>
>This is why we have Lint, Preprocessors and other supporting module that
>make sure you are not
>inputting garbage as the afore mentioned for loop.
>
They are NOT C.

They are like ketchup on a good meal. Some people have no taste at all 
and put the crap on everything, others prefer the taste of the original 
meal.

> This is the offending
>Program and not the Compiler it self.
> As these error checking programs have no standards in place, every firm
>that has ever written a compiler
>is also writing it's corresponding error checking modules at it's
leisure.
>This is where my complaint lies and not
>with the Compiler itself but because the word Compiler is so ingrained in us
>we all take this short cut.
>
That's agreed, however the task of these programs should be to
detect 
errors according to C. And this is NOT an error. It shouldn't even post 
a warning. At most it should post a comment on the crappy programming 
style. But in every program like this I've ever seen the user gets to 
select what messages get displayed. many programs even allow certain 
errors to be turned off, or at least to select between ANSI and 
'deviant' C styles. They ALL allow warnings to be selectively turned
on 
and off, and those that have a third level allow that to be turned off. 
In most cases the default appears to be all errors on, selected warnings 
on and remarks off. The first thing I always do is turn off lower level 
commentary, frankly as a programmer I don't want to know what some dumb 
piece of code thinks about my style, I understand what I write and where 
I write it.

To me the ONLY use for these remarks is to help new comers to 
programming get some ideas of what might be considered good and bad code.

>The short sighted technical support people are
always invoking the same
>excuse. That K&R is not providing
>for this type of checking and as such they are not REQUIRED to do it. It is
>the Programmer's fault!
>
Absolutely, because error checkers should check for errors, style 
checkers are a different thing, and highly open to interpretation by the 
writers. I'd never turn one on personally, they'd hate me.

>And they want an arm and a leg for their mediocre
product!
>
If you have followed my posts here you'll know that I'm not a
fan of IAR 
at all, but even I don't think the product is mediocre, I think it is a 
pretty good product, the mediocrity that comes with IAR in my opinion is 
there absolutely crap support and attitude to fixing bugs when they 
happen. The product is far too expensive for that level of support. 
Others here love the product. My opinion is based solely on my own 
experiences with IAR, not even the reinforcing commentaryt I've heard 
here, because there is nearly as much commentary supporting their 
product, as a product, perhaps not as VFM.

At the end of the day it is up to the programmer to write good code, if 
what they write is not illegal it should get compiled. If it is dumb, 
perhaps they should get recompiled.

Cheers

Al

>
>Alex
>
>
>
>
>----- Original Message ----- 
>From: "Onestone" <onestone@ones...>
>To: <msp430@msp4...>
>Sent: Thursday, July 07, 2005 6:24 PM
>Subject: Re: [msp430] MSP430 compiler recommendations A
>
>
>  
>
>>This is not an error, it is a valid for statement. there are many types
>>of for() statement that don't end, and that aren't required
to. the most
>>obvious being for(;;); These are allowed. Whether or not you do it
>>intentionally is another thing. This i the great thing about C. It
>>doesn't nannny you and stop you doing things that are unusual, but
>>leaves it up to you to know what you are doing. Mistakes are allowed,
>>the compiler ccan't read your mind. You may well have wanted a
never
>>ending loop, or you may have some strange piece of code that manipulates
>>t inside the for statement and forces an exit. I've seen far
stranger
>>things than that done.
>>
>>Al
>>
>>alex@alex... wrote:
>>
>>    
>>
>>>REMARKS ARE ENABLED...
>>>I hate it when you are presuming that  the programmer is ALWAYS at
fault!
>>>
>>>BTW. This is an ERROR not a programming foot note ! If IAR wants to
make
>>>it's own class of error reporting
>>>it has to educate it's constituency, not just throw a 1 line 
obscure
>>>instruction which is hard to find.
>>>
>>>
>>>Alex
>>>
>>>
>>>
>>>iginal Message ----- 
>>>From: "Paul Curtis" <plc@plc@...>
>>>To: <msp430@msp4...>
>>>Sent: Wednesday, July 06, 2005 10:16 PM
>>>Subject: RE: [msp430] MSP430 compiler recommendations A
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>Hi Alex,
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Here come my 2 bits too :)
>>>>>
>>>>>The following error is NOT detected by IAR:) It cost me 2
>>>>>hours of debugging:(
>>>>>
>>>>>void main ()
>>>>>{
>>>>>       char t;
>>>>>
>>>>>           for ( t=0; t<= 1000;t++){}     // Bad
Lint! FOR
>>>>>loop never ends!
>>>>>
>>>>>           while(1){}
>>>>>
>>>>>}// END MAIN
>>>>>
>>>>>For $2700 I would expected that not to happen :(
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>For $2700, you do:
>>>>
>>>>Remark[Pe236]: controlling expression is constant C:\Documents
and
>>>>Settings\plc\My Documents\IAR Embedded Workbench\test.cpp
>>>>
>>>>You need to enable remarks.  What's the point of a manual
if nobody
>>>>bothers to read it?  :-(  Could've saved yourself those two
hours with a
>>>>quick scout through the manual perhaps?
>>>>
>>>>Some customers treat tech support an an online manual service
when
>>>>they're too lazy to bring up the Help > Search
themselves.  I now
>>>>usually send back a link to our web-based manuals.  And some
customers
>>>>bitch that they can't do so-and-so yet have never actually
looked at the
>>>>documentation.
>>>>
>>>>--
>>>>Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
>>>>CrossWorks for MSP430, ARM, AVR and now MAXQ processors
>>>>
>>>>
>>>>
>>>>.
>>>>
>>>>
>>>>Yahoo! Groups Links
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>    
>>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>


Reply by Paul Curtis July 8, 20052005-07-08
Alex, 

> Also. We need to be very cautious when we use the
word 
> "Compiler". In the strictest sense of the word and according 
> to K&R the Compiler it self has no error checking facilities 
> at all. This is not it's job.
> The Compiler's duty is to take the source code and transform 
> it in an intermediate file that is acceptable by the next 
> processing step. This is all! No error checking here.

The ISO standard does not use the word "compiler".  The days of Turbo
Pascal stop-on-error are long past.  A compiler's job it to diagnose
syntactic errors in the user's program and, to a certain extent, the
semantic ones too, and generate correct code for the specification the
user supplied.

> This is why we have Lint, Preprocessors and other
supporting 
> module that make sure you are not inputting garbage as the 
> afore mentioned for loop. This is the offending Program and 
> not the Compiler it self.
>  As these error checking programs have no standards in place, 
> every firm that has ever written a compiler is also writing 
> it's corresponding error checking modules at it's leisure.
> This is where my complaint lies and not
> with the Compiler itself but because the word Compiler is so 
> ingrained in us we all take this short cut.

The ISO standard does not use the word "compiler" in its main text. 
It
is mentioned once in a footnote.  A translator's job is to take source
form and prepare it for execution in an execution environment, and do
some other bits along the way such as diagnose human defects.

> The short sighted technical support people are
always 
> invoking the same excuse. That K&R is not providing for this 
> type of checking and as such they are not REQUIRED to do it. 
> It is the Programmer's fault!

If you are dealing with high-reliability software, why not use a
programs such as Spade and MALPAS?  In this case, you'll get to know an
awful lot about your program.

There's a point where this checking must end.  Consider this:

void toeless_request(void)
{
  int x[1];
  int *y = x;
  y[1] = 0;
}

Should a compiler diagnose the runtime error in this program?  How about
more complex examples?  There is only so much a "compiler" can do. 
Only
purchase compilers that you like and that suit your needs--you have a
choice.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

Reply by July 8, 20052005-07-08
Al, I disagree... No matter how you look to this code, even from the
perspective of quantum mechanics,
this code is an ERROR! The intent of the FOR loop here is to terminate on a
certain and well defined counter value.
 Otherwise the programmer leaves this field free, case in which the for loop
becomes similar to a while loop.

Also. We need to be very cautious when we use the word "Compiler". In
the
strictest sense of the word
and according to K&R the Compiler it self has no error checking facilities
at all. This is not it's job.
The Compiler's duty is to take the source code and transform it in an
intermediate file that is
acceptable by the next processing step. This is all! No error checking here.

This is why we have Lint, Preprocessors and other supporting module that
make sure you are not
inputting garbage as the afore mentioned for loop. This is the offending
Program and not the Compiler it self.
 As these error checking programs have no standards in place, every firm
that has ever written a compiler
is also writing it's corresponding error checking modules at it's
leisure.
This is where my complaint lies and not
with the Compiler itself but because the word Compiler is so ingrained in us
we all take this short cut.

The short sighted technical support people are always invoking the same
excuse. That K&R is not providing
for this type of checking and as such they are not REQUIRED to do it. It is
the Programmer's fault!

And they want an arm and a leg for their mediocre product!

Alex




----- Original Message ----- 
From: "Onestone" <onestone@ones...>
To: <msp430@msp4...>
Sent: Thursday, July 07, 2005 6:24 PM
Subject: Re: [msp430] MSP430 compiler recommendations A


> This is not an error, it is a valid for statement.
there are many types
> of for() statement that don't end, and that aren't required to.
the most
> obvious being for(;;); These are allowed. Whether or not you do it
> intentionally is another thing. This i the great thing about C. It
> doesn't nannny you and stop you doing things that are unusual, but
> leaves it up to you to know what you are doing. Mistakes are allowed,
> the compiler ccan't read your mind. You may well have wanted a never
> ending loop, or you may have some strange piece of code that manipulates
> t inside the for statement and forces an exit. I've seen far stranger
> things than that done.
>
> Al
>
> alex@alex... wrote:
>
> >REMARKS ARE ENABLED...
> >I hate it when you are presuming that  the programmer is ALWAYS at
fault!
> >
> >BTW. This is an ERROR not a programming foot note ! If IAR wants to
make
> >it's own class of error reporting
> >it has to educate it's constituency, not just throw a 1 line 
obscure
> >instruction which is hard to find.
> >
> >
> >Alex
> >
> >
> >
> >iginal Message ----- 
> >From: "Paul Curtis" <plc@plc@...>
> >To: <msp430@msp4...>
> >Sent: Wednesday, July 06, 2005 10:16 PM
> >Subject: RE: [msp430] MSP430 compiler recommendations A
> >
> >
> >
> >
> >>Hi Alex,
> >>
> >>
> >>
> >>>Here come my 2 bits too :)
> >>>
> >>>The following error is NOT detected by IAR:) It cost me 2
> >>>hours of debugging:(
> >>>
> >>>void main ()
> >>>{
> >>>        char t;
> >>>
> >>>            for ( t=0; t<= 1000;t++){}     // Bad Lint!
FOR
> >>>loop never ends!
> >>>
> >>>            while(1){}
> >>>
> >>>}// END MAIN
> >>>
> >>>For $2700 I would expected that not to happen :(
> >>>
> >>>
> >>For $2700, you do:
> >>
> >>Remark[Pe236]: controlling expression is constant C:\Documents and
> >>Settings\plc\My Documents\IAR Embedded Workbench\test.cpp
> >>
> >>You need to enable remarks.  What's the point of a manual if
nobody
> >>bothers to read it?  :-(  Could've saved yourself those two
hours with a
> >>quick scout through the manual perhaps?
> >>
> >>Some customers treat tech support an an online manual service when
> >>they're too lazy to bring up the Help > Search themselves. 
I now
> >>usually send back a link to our web-based manuals.  And some
customers
> >>bitch that they can't do so-and-so yet have never actually
looked at the
> >>documentation.
> >>
> >>--
> >>Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
> >>CrossWorks for MSP430, ARM, AVR and now MAXQ processors
> >>
> >>
> >>
> >>.
> >>
> >>
> >>Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >.
> >
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
> .
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>