EmbeddedRelated.com
Forums

MISRA new rule suggestion

Started by Rob June 20, 2005
"CBFalconer" <cbfalconer@yahoo.com> wrote in message
news:42BB1F0A.6FCAF7A4@yahoo.com...
> > 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.
Can''t you just rotate the cap on the -/_ key 180 degrees? But seriously, one could wonder why no programmers editor/IDE vendor in the world has come up with a "keyboard-in-C-mode" mode, where you actually do not have to press shift to get _..... For some stupid reasong I always use uderscores when programming in C or assembly, while at the same time I use capitals when programming in Pascal. Weird guys, those programmers... Meindert
"Meindert Sprang" <mhsprang@NOcustomSPAMware.nl> writes:
> But seriously, one could wonder why no programmers editor/IDE vendor > in the world has come up with a "keyboard-in-C-mode" mode, where you > actually do not have to press shift to get _.....
In Emacs, you could swap the keys this way: (define-key global-map "-" '(lambda () (interactive) (insert "_"))) (define-key global-map "_" '(lambda () (interactive) (insert "-"))) Is it not similarly trivial to do this in other editors?
cstacy@news.dtpq.com (Christopher C. Stacy) writes:

> "Meindert Sprang" <mhsprang@NOcustomSPAMware.nl> writes: > > But seriously, one could wonder why no programmers editor/IDE vendor > > in the world has come up with a "keyboard-in-C-mode" mode, where you > > actually do not have to press shift to get _..... > > In Emacs, you could swap the keys this way: > > (define-key global-map "-" '(lambda () (interactive) (insert "_"))) > (define-key global-map "_" '(lambda () (interactive) (insert "-"))) > > Is it not similarly trivial to do this in other editors?
I suppose I should have put those on the C-mode key map.
On Fri, 24 Jun 2005 07:44:06 +0200, "Meindert Sprang"
<mhsprang@NOcustomSPAMware.nl> wrote:

[...]
>For some stupid reasong I always use uderscores when programming in C or >assembly, while at the same time I use capitals when programming in Pascal.
Might it be, perhaps, that standard Pascal doesn't (didn't?) permit underscores in identifiers?
>Weird guys, those programmers...
Goes without saying. Regards, -=Dave -- Change is inevitable, progress is not.
"CBFalconer" <cbfalconer@yahoo.com> wrote in message
news:42BB1F0A.6FCAF7A4@yahoo.com...
> 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.
Alt-numeric can "type" any printable character. This _ was inserted with alt-0-9-5. Not that that solves the laziness problem.
Meindert Sprang wrote:

> "CBFalconer" <cbfalconer@yahoo.com> wrote in message > news:42BB1F0A.6FCAF7A4@yahoo.com... >> > 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. > > Can''t you just rotate the cap on the -/_ key 180 degrees? > > But seriously, one could wonder why no programmers editor/IDE vendor in > the world has come up with a "keyboard-in-C-mode" mode, where you actually > do not have to press shift to get _..... > > For some stupid reasong I always use uderscores when programming in C or > assembly, while at the same time I use capitals when programming in > Pascal. Weird guys, those programmers... > > Meindert
If it was only that _ char. On my german keyboard I must use the right alt key (AltGr) to get the {[]}|~@\ keys. This is a very "nice" design of "international keyboards". So using a shift ky for _ is no nuisance compared to all the chars I need for programming. -- Reinhardt Behm, Nauheim, Germany, reinhardt.behm@t-online.de
On 23 Jun 2005 22:35:49 GMT, in msg <3i0rq5Fiu9rvU4@news.dfncis.de>,
Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> wrote:

>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.
Most of my work is embedded assembly language programming, where the language is seldom supported by my text editor (Codewright) in the detail needed search for 'i' as a word, or a byte, or as a macro substitution parameter, or a variable in a conditional 'IF', or in an EQU statement, etc. But assembly language is a bit OT from the original discussion... In 'C' you make a good point. -Zonn -- Zonn Moore Remove the ".AOL" from the Zektor, LLC email address to reply. www.zektor.com
Hans-Bernhard Broeker wrote:
> 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.
When you need to use the search facility of an editor to find a variable such as 'i' this is often the case that you have a function that spans many pages. I sometimes had to do so but I cursed the lousy programmer who left a buggy and unfinished work and had not been able to split its work into manageable functions. When I write the code the functions are short. I can locate easily the local variables even with short names. The global variables have long names and can be easily found by the editor.
On Fri, 24 Jun 2005 14:56:51 -0700, Zonn <news-zonn@zektor.AOL.com>
wrote:

>On 23 Jun 2005 22:35:49 GMT, in msg <3i0rq5Fiu9rvU4@news.dfncis.de>, >Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> wrote: >
[...]
>>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. > >Most of my work is embedded assembly language programming, where the language is >seldom supported by my text editor (Codewright) in the detail needed search for >'i' as a word, or a byte, or as a macro substitution parameter, or a variable in >a conditional 'IF', or in an EQU statement, etc.
CodeWright is well able to search for a single-character variable (such as 'i'). But it's not the way I have it set up by default -- you have to get mouse-clicky or at least learn the keyboard equivalents. I can search for [^A-Za-z_]i[^A-Za-z_] from my standard seach (which is a somewhat painful amount of typing, and also happens to include whatever precedes and follows the variable. To change all instances of the variable 'i' to 'x', the search pattern would be ([^A-Za-z_])i([^A-Za-z_]) and the replacement pattern would be \1x\2. Certainly doable, but searching for (and replacing) 'idx' is simpler. the substring doesn't generally appear within other identifiers. Otherwise, I have to resort to using the "dialog" box search, which has every possible option except fixing the kitchen sink. To perform the search without a mouse, I have to use Alt s (note: NOT Alt-s) s (again) i (what I'm searching for) Alt-w (limit to whole-word) enter. To perform the replacement, it's Alt s r i (what I'm searching for) Alt-r x (replacement value) Alt-w enter (This will give me a prompt for each replacement -- If I want to do a global replacement, Alt-g before enter, or if I want to do a single replacement, Alt-s before enter). You can also use the dialog box to search in multiple files. You can probably set all the options necessary to do the from the keyboard, but I wouldn't try it. I certainly wouldn't try to memorize them all... Regards, -=Dave -- Change is inevitable, progress is not.
On Fri, 24 Jun 2005 14:56:51 -0700, Zonn <news-zonn@zektor.AOL.com>
wrote:

>On 23 Jun 2005 22:35:49 GMT, in msg <3i0rq5Fiu9rvU4@news.dfncis.de>, >Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> wrote: > >>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. > >Most of my work is embedded assembly language programming, where the language is >seldom supported by my text editor (Codewright) in the detail needed search for >'i' as a word, or a byte, or as a macro substitution parameter, or a variable in >a conditional 'IF', or in an EQU statement, etc.
Even Windows Wordpad contains the search options "Match whole words only" and "Match case", which works quite well searching for variable i or j :-) The RSX-11 EDT screen editor had the concept of "word" and user definable word separators a quarter of a century ago. It would be quite a surprise if an editor intended for program development would not have such features these days even in the language insensitive mode. Paul