EmbeddedRelated.com
Forums

MISRA new rule suggestion

Started by Rob June 20, 2005
Kelly Hall wrote:
> David Brown wrote: > >> I dislike for() loops that are so long or complicated that a >> simple "i" is insufficient for the loop variable. > > Yeah, I have a few habits left over from programming in Fortran, > too ;)
I think I wrote my last Fortran about 1970. However, I avoid i and l, but will bandy about ix and iy. I have fewer objections to j and k, n, m, and p. n and p are relatively common. -- Some informative links: news:news.announce.newusers http://www.geocities.com/nnqweb/ http://www.catb.org/~esr/faqs/smart-questions.html http://www.caliburn.nl/topposting.html http://www.netmeister.org/news/learn2quote.html
On Wed, 22 Jun 2005 15:11:18 GMT, CBFalconer <cbfalconer@yahoo.com>
wrote:

>Rob wrote: >> >... snip ... >> >> Is it me or do I seem to have a dislike of _'s ? > >I seem to be one of the very few who agree with you. I think it is >a consequence of extreme laziness, and thus reluctance to use the >shift key.
Prithee tell, how doth one type _ without using the shift key? If you want an example of extreme laziness, look at C "programmers" who don't bother to lint their code. But I'm crossing subthreads now... Regards, -=Dave -- Change is inevitable, progress is not.
Dave Hansen wrote:
> On Wed, 22 Jun 2005 15:11:18 GMT, CBFalconer <cbfalconer@yahoo.com> > wrote: > > >Rob wrote: > >> > >... snip ... > >> > >> Is it me or do I seem to have a dislike of _'s ? > > > >I seem to be one of the very few who agree with you. I think it is > >a consequence of extreme laziness, and thus reluctance to use the > >shift key. > > Prithee tell, how doth one type _ without using the shift key?
By using a non english keyboard, at least some. That could explain why underscores are used at some places. Or it could be the other way around.
> If you want an example of extreme laziness, look at C "programmers" > who don't bother to lint their code.
> But I'm crossing subthreads now...
iddw@hotmail.com (Dave Hansen) writes:
> > If you want an example of extreme laziness, look at C "programmers" > who don't bother to lint their code. But I'm crossing subthreads > now...
Actually, they aren't programmers. Those are monkeys. cheers, Rich. -- rich walker | Shadow Robot Company | rw@shadow.org.uk technical director 251 Liverpool Road | need a Hand? London N1 1LX | +UK 20 7700 2487 www.shadow.org.uk/products/newhand.shtml
> > Underscores are an aid to understanding (I'd be even happier if they > were allowed in numeric literals -- I have a 64-bit constant in the > code I'm working on now, and I think 0x8000_FF00_1680_0000 would be > easier to understand than 0x8000FF0016800000, and even 120_000 vs. > 120000). >
Underscores in numeric literals are both allowed and encouraged in Ada. For example Initial_Balance := 510_020_400_123; Pi := 3.14159_26535_89793_23846; or for Control_Register'Address use 16#00F0_A010#; --Britt
On Thu, 23 Jun 2005 14:18:48 GMT, in msg <42BA7DB0.1C9AEBE5@yahoo.com>,
CBFalconer <cbfalconer@yahoo.com> wrote:

>Kelly Hall wrote: >> David Brown wrote: >> >>> I dislike for() loops that are so long or complicated that a >>> simple "i" is insufficient for the loop variable. >> >> Yeah, I have a few habits left over from programming in Fortran, >> too ;)
I still like using i - n as counters, left over from my Fortran days, however there is a cool trick a co-worker shared with me over 20 years ago that I still use: If you double up the letters in your simple counters using 'ii', 'jj' or 'cc' for a throw away character, etc. as variable names, you'll have a *much* easier time searching for them in your text editor. For instance try searching for 'i' and 'ii' in this email. I'm also *absolute* in starting all my globals with a capital, and all local without a capital letter. It can always tell whether a variable is a local or global. -Zonn -- Zonn Moore Remove the ".AOL" from the Zektor, LLC email address to reply. www.zektor.com
On Thu, 23 Jun 2005 13:18:01 GMT, Dave Hansen <iddw@hotmail.com> wrote:

> Underscores are an aid to understanding (I'd be even happier if they > were allowed in numeric literals -- I have a 64-bit constant in the > code I'm working on now, and I think 0x8000_FF00_1680_0000 would be > easier to understand than 0x8000FF0016800000, and even 120_000 vs. > 120000).
There was a set of rather nifty macros a while ago. They are for binary representation, but you get the idea. <URL:http://groups.google.co.uk/group/comp.arch.embedded/browse_thread/thread/4bda007b0cd708fc/7776227d1e34df58> Vadim
Dave Hansen wrote:
> CBFalconer <cbfalconer@yahoo.com> wrote: >> Rob wrote: >>> >>... snip ... >>> >>> Is it me or do I seem to have a dislike of _'s ? >> >> I seem to be one of the very few who agree with you. I think >> it is a consequence of extreme laziness, and thus reluctance >> to use the shift key. > > Prithee tell, how doth one type _ without using the shift key?
One doesn't, thus catering to dislikes of excess labor and of the presence of '_'s in source text. If I must use the shift key, at least let me use a normal alpha key with it. -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson
Zonn <news-zonn@zektor.aol.com> wrote:

> If you double up the letters in your simple counters using 'ii', > 'jj' or 'cc' for a throw away character, etc. as variable names, > you'll have a *much* easier time searching for them in your text > editor.
Only for rather limited-capability instances of "text editor". A programmers' editor that can't search for 'i' as a *word* (as understood by the programming language being edited) isn't really worth your money. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
CBFalconer <cbfalconer@yahoo.com> writes:

> Dave Hansen wrote: > > CBFalconer <cbfalconer@yahoo.com> wrote: > >> Rob wrote: > >>> > >>... snip ... > >>> > >>> Is it me or do I seem to have a dislike of _'s ? > >> > >> I seem to be one of the very few who agree with you. I think > >> it is a consequence of extreme laziness, and thus reluctance > >> to use the shift key. > > > > Prithee tell, how doth one type _ without using the shift key? > > One doesn't, thus catering to dislikes of excess labor and of the > presence of '_'s in source text. If I must use the shift key, at > least let me use a normal alpha key with it.
Remap your keyboard?