MISRA new rule suggestion

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?

Reply to
Christopher C. Stacy
Loading thread data ...

I suppose I should have put those on the C-mode key map.

Reply to
Christopher C. Stacy
[...]

Might it be, perhaps, that standard Pascal doesn't (didn't?) permit underscores in identifiers?

Goes without saying. Regards,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen

Alt-numeric can "type" any printable character.

This _ was inserted with alt-0-9-5.

Not that that solves the laziness problem.

Reply to
Richard Henry

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
Reply to
Reinardt Behm

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
Reply to
Zonn

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.

Reply to
Lanarcam

[...]

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.
Reply to
Dave Hansen

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

Reply to
Paul Keinanen

more confusion....

And probably a little mis_standing.

Reply to
Rob

Well, in Forth we use the dash convention often too. I have defined the word _ as "push a don't care value to the stack". Its prononciation is "don't care". Forth uses any number of weird character combinations, but the prononciation is known:

*/mod "star-slash-mod" +! "plus-store" $^ "string-index"

Not only the founder, Chuck Moore, insists that words are pronouncable, he prefers them to form sentences.

Further most Forth's are case-insensitive, although I don't really like that.

Groetjes Albert.

--

--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@spenarnc.xs4all.nl http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.