|
Actually, if the behavior is defined as it is in C, x++ doesn't mean quite the same thing as as x = x + 1. If the x++ is part of an expression like while(array[x++]) x is incremented after the logical value of the expression is evaluated. Of course, there's the evil twin, ++x. When I took C in school, in all three quarters we were allowed to bring an operator precedence cheat sheet to all the tests. I think most people decide on a way of using the unary operators and don't change once they have a method they understand. Of course, there's always the dereferencing operator...I actually like a lot of things about RPG.<BG> -----Original Message----- From: John Hall [mailto:jhall@hillmgt.com] Sent: Thursday, May 13, 1999 6:15 AM To: MIDRANGE-L@midrange.com Subject: Re: CF -Specs (was: "x-Spec") Evan Harris wrote: > > John Hall wrote: > > > >What do those unary operators do? > > > > Confuse the logic, remove some of the self documenting features of code... > > I honestly can't see what having counter++ adds to the language. Sure, it > saves a few keystrokes; sure, it makes you feel like yourd doing C; sure, > it shows you are in the know. > > But, when you are trying to debug the code, or someon else is, its not > nearly so intuitive as to what it's actually doing. > > To me it *implies* an add operation, rather then explicitly stating it, > seems to me this is *bad* > I don't get this logic at all ???? If x++ is DEFINED in the language then it does not *imply* anything. Any more than x = x + 1 *implies* that you are adding 1 to x. ++ is *explicitly* stating it. The idea behind the unary operators is not to save typing but to increase readability. x++ vs x = x + 1 or eval x = x + 1 or ADD 1 X Which one can be scanned more quickly and picked out of a source listing more easily ? Well anyway I think it would be a nice feature to add. The idea being to borrow the best from other languages to improve RPG. Of course what IBM really needs to do is borrow a page from M$ and rename it to RAPG tm. (Rapid Application Program Generator). Call it all new and improved etc. Greatest thing since Al Gore invented the internet .... This would probably be more effective in making it "cool" than any syntax changes they could make in the next 5 years. Some of the features: Full backward compatability Context sensitive prompting Embedded SQL Fantastic File I/O routines built in. - Automatic record/variable declarations. Sophisticated Error Handling. runs on the latest 64 bit machines - the IIAS400 (Integrated Internet Application Server) etc etc etc Oh wait - we have all that ... John Hall Home Sales Co. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.