Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9273 > unrolled thread
| Started by | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| First post | 2011-10-28 06:46 -0700 |
| Last post | 2011-10-31 17:38 +0100 |
| Articles | 18 on this page of 38 — 16 participants |
Back to article view | Back to comp.lang.java.programmer
code generation for the ternary operator Roedy Green <see_website@mindprod.com.invalid> - 2011-10-28 06:46 -0700
Re: code generation for the ternary operator Jaap Droogers <JaapDroogers@unusable.meel.homelinux.net> - 2011-10-28 16:07 +0200
Re: code generation for the ternary operator markspace <-@.> - 2011-10-28 08:32 -0700
Re: code generation for the ternary operator Owen Jacobson <angrybaldguy@gmail.com> - 2011-11-01 01:53 -0400
Re: code generation for the ternary operator Roedy Green <see_website@mindprod.com.invalid> - 2011-11-01 06:25 -0700
Source code representation (was: code generation for the ternary operator). Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-01 09:41 -0700
Re: Source code representation Patricia Shanahan <pats@acm.org> - 2011-11-01 13:46 -0700
Re: Source code representation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-01 16:09 -0700
Re: Source code representation Roedy Green <see_website@mindprod.com.invalid> - 2011-11-01 23:54 -0700
Re: Source code representation (was: code generation for the ternary operator). Gene Wirchenko <genew@ocis.net> - 2011-11-01 17:33 -0700
Re: Source code representation (was: code generation for the ternary operator). Roedy Green <see_website@mindprod.com.invalid> - 2011-11-02 01:19 -0700
Re: Source code representation (was: code generation for the ternary operator). Gene Wirchenko <genew@ocis.net> - 2011-11-02 09:42 -0700
Re: Source code representation (was: code generation for the ternary operator). Lew <lewbloch@gmail.com> - 2011-11-02 07:45 -0700
Re: Source code representation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-02 10:58 -0700
Re: Source code representation Gene Wirchenko <genew@ocis.net> - 2011-11-02 14:11 -0700
Re: Source code representation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-02 15:21 -0700
Re: Source code representation Gene Wirchenko <genew@ocis.net> - 2011-11-02 16:07 -0700
Re: Source code representation (was: code generation for the ternary operator). Roedy Green <see_website@mindprod.com.invalid> - 2011-11-01 23:52 -0700
Re: Source code representation (was: code generation for the ternary operator). Gene Wirchenko <genew@ocis.net> - 2011-11-02 09:47 -0700
Re: Source code representation (was: code generation for the ternary operator). Martin Gregorie <martin@address-in-sig.invalid> - 2011-11-02 20:58 +0000
Re: Source code representation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-02 15:27 -0700
Re: Source code representation Martin Gregorie <martin@address-in-sig.invalid> - 2011-11-02 23:18 +0000
Re: Source code representation Lew <lewbloch@gmail.com> - 2011-11-02 17:30 -0700
Re: Source code representation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-02 15:30 -0700
Re: Source code representation Gene Wirchenko <genew@ocis.net> - 2011-11-02 21:30 -0700
Re: Source code representation Lew <lewbloch@gmail.com> - 2011-11-02 22:07 -0700
Re: Source code representation Arne Vajhøj <arne@vajhoej.dk> - 2011-11-05 21:01 -0400
Re: code generation for the ternary operator Arne Vajhøj <arne@vajhoej.dk> - 2011-11-05 20:56 -0400
Re: code generation for the ternary operator rossum <rossum48@coldmail.com> - 2011-10-29 13:01 +0100
Re: code generation for the ternary operator Lew <lewbloch@gmail.com> - 2011-10-29 10:46 -0700
Re: code generation for the ternary operator Henk van Voorthuijsen <voorth@xs4all.nl> - 2011-10-28 08:05 -0700
Re: code generation for the ternary operator Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-28 15:41 +0000
Re: code generation for the ternary operator Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-28 10:31 -0700
Re: code generation for the ternary operator Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-10-29 03:24 +0200
Re: code generation for the ternary operator Wanja Gayk <brixomatic@yahoo.com> - 2011-10-29 00:23 +0200
Re: code generation for the ternary operator Lew <lewbloch@gmail.com> - 2011-10-29 10:50 -0700
Re: code generation for the ternary operator Wanja Gayk <brixomatic@yahoo.com> - 2011-11-01 13:36 +0100
Re: code generation for the ternary operator Michal Kleczek <kleku@poczta.onet.pl> - 2011-10-31 17:38 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2011-11-02 15:27 -0700 |
| Subject | Re: Source code representation |
| Message-ID | <Ntjsq.15436$Cr1.539@newsfe03.iad> |
| In reply to | #9383 |
On 11/2/11 1:58 PM, Martin Gregorie wrote: > I prefer to develop Java with a command line, text editor and ant. I've > used IntelliJ and generally liked it once I'd gotten used to that busy > screen, except for one thing: apart from specific refactoring facilities > its text editor seemed to be missing all but the most basic editing > functions - there were times I'd have killed for a general-purpose regex- > based search-and-replace facility. What version of IntelliJ did you use? I'm using 10 now, and it has had regex search/replace for a long time. It also has structural search and replace, which is a bit more powerful but more complicated to set up. On top of all that, the editor has really good auto completion support. It's gotten so smart about it that you don't even need to use hot-keys for auto completion; just use the punctuation you would use normally, such as parenthesis or dot. Sure, it will rarely get in the way and do the wrong thing, but by and large it greatly improves my productivity.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2011-11-02 23:18 +0000 |
| Subject | Re: Source code representation |
| Message-ID | <j8sj40$m93$1@localhost.localdomain> |
| In reply to | #9398 |
On Wed, 02 Nov 2011 15:27:56 -0700, Daniel Pitts wrote: > What version of IntelliJ did you use? I'm using 10 now, and it has had > regex search/replace for a long time. It also has structural search and > replace, which is a bit more powerful but more complicated to set up. > I can't remember the version, but it was back in spring, 2008. > On top of all that, the editor has really good auto completion support. > Sounds like its come on a long way since I last saw it. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-11-02 17:30 -0700 |
| Subject | Re: Source code representation |
| Message-ID | <3863893.986.1320280201397.JavaMail.geo-discussion-forums@prfp13> |
| In reply to | #9398 |
On Wednesday, November 2, 2011 3:27:56 PM UTC-7, Daniel Pitts wrote: > On 11/2/11 1:58 PM, Martin Gregorie wrote: > > I prefer to develop Java with a command line, text editor and ant. I've > > used IntelliJ and generally liked it once I'd gotten used to that busy > > screen, except for one thing: apart from specific refactoring facilities > > its text editor seemed to be missing all but the most basic editing > > functions - there were times I'd have killed for a general-purpose regex- > > based search-and-replace facility. > > What version of IntelliJ did you use? I'm using 10 now, and it has had > regex search/replace for a long time. It also has structural search and > replace, which is a bit more powerful but more complicated to set up. NetBeans and Eclipse also have full-featured regex search(-and-replace), and have had for a long time. > On top of all that, the editor has really good auto completion support. > It's gotten so smart about it that you don't even need to use hot-keys > for auto completion; just use the punctuation you would use normally, > such as parenthesis or dot. Sure, it will rarely get in the way and do > the wrong thing, but by and large it greatly improves my productivity. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2011-11-02 15:30 -0700 |
| Subject | Re: Source code representation |
| Message-ID | <pwjsq.15437$Cr1.6621@newsfe03.iad> |
| In reply to | #9378 |
On 11/2/11 9:47 AM, Gene Wirchenko wrote: > On Tue, 01 Nov 2011 23:52:26 -0700, Roedy Green > <see_website@mindprod.com.invalid> wrote: >> 4. Experienced programmers think of programming as manipulating text. >> They have to be weaned to think more of thinking of programming as >> more like plumbing where you interconnect names. Eventually editing >> will be much more visual where you select methods, drag variables into >> place, and do a lot of selecting from a list of what the SCID >> considers most plausible. > > Typing is much faster than mousing for me. The text interface is > also simpler. I can use my own editor that fits my preferences rather > than getting locked into a GUI IDE. No one says you have to use a mouse. Typing is *much* faster for me for most tasks. You can have a GUI view that is focused on pointer-based input. >> I have been pitching some of these ideas to IntelliJ. I am using the >> notion of almost-subliminal differences in the way text is rendered to >> give additional information about each symbol without having to look >> back at the definition. Given that you are not supposed to even >> notice the difference perhaps contrarians will then argue for more >> distinctive warping. > > I tend to find such things distracting and prefer to not have > them. Which is why such things tend to be configurable. Maybe when you start working on sufficiently large code-bases, you'll appreciate these productivity enhancers. Or maybe you'll always be a second-tier engineer.
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2011-11-02 21:30 -0700 |
| Subject | Re: Source code representation |
| Message-ID | <i364b79824nj78jht0dqp9g1br8l3f534s@4ax.com> |
| In reply to | #9399 |
On Wed, 02 Nov 2011 15:30:45 -0700, Daniel Pitts
<newsgroup.nospam@virtualinfinity.net> wrote:
>On 11/2/11 9:47 AM, Gene Wirchenko wrote:
[snip]
>> I tend to find such things distracting and prefer to not have
>> them.
>Which is why such things tend to be configurable. Maybe when you start
>working on sufficiently large code-bases, you'll appreciate these
>productivity enhancers. Or maybe you'll always be a second-tier engineer.
Or perhaps, I will hold a reasonable opinion for good reason that
is different from yours regardless of your insults.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-11-02 22:07 -0700 |
| Subject | Re: Source code representation |
| Message-ID | <9835217.2064.1320296852191.JavaMail.geo-discussion-forums@prap37> |
| In reply to | #9419 |
Gene Wirchenko wrote: > Daniel Pitts >> Which is why such things tend to be configurable. Maybe when you start >> working on sufficiently large code-bases, you'll appreciate these >> productivity enhancers. Or maybe you'll always be a second-tier engineer. > > Or perhaps, I will hold a reasonable opinion for good reason that > is different from yours regardless of your insults. I think you guys should retire to your corners and grab a squirt-and-spit of water before the next round. DING! -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2011-11-05 21:01 -0400 |
| Subject | Re: Source code representation |
| Message-ID | <4eb5dc85$0$281$14726298@news.sunsite.dk> |
| In reply to | #9341 |
On 11/1/2011 12:41 PM, Daniel Pitts wrote: > I've often thought about a "new" way of representing code, where the > logical structure is stored in not-necessarily-human-editable format, > but the tools for managing the code allow it to be presented in a format > chosen by the particular maintainer. > > In other words, you have the language constructs (classes, methods, > fields, statements, aspects, loops, etc...) modeled, and then have view > in front of that model which make them "look" like something that can be > manipulated easily by the programmer. > > I would imagine such a system has a bit of ramp-up time, but it would > eventually allow you to be much more productive. The "concrete" manor > that the object model stores things would allow you to refactor very > easily. According to various rumors then VS 2012 will allow the developers to view a given piece of code as C# or VB.NET as a choice. Arne
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2011-11-05 20:56 -0400 |
| Message-ID | <4eb5db35$0$281$14726298@news.sunsite.dk> |
| In reply to | #9276 |
On 10/28/2011 11:32 AM, markspace wrote: > On 10/28/2011 7:07 AM, Jaap Droogers wrote: > >> On 28-10-11 15:46, schreef Roedy Green: >>> int count = lines *3; >>> if ( b1 ) count += 2; >>> if ( b2 ) count += 2; > >> Always use curly brackets: > > I prefer Roedy's version here, it's easier to read. Never say never, and > never say always. You can omit braces when they reduce code readability. Do they ever reduce the readability enough to outweigh: * the risk of an extra statement being incorrectly added * not following Java coding convention ? I would tend to say no. Arne
[toc] | [prev] | [next] | [standalone]
| From | rossum <rossum48@coldmail.com> |
|---|---|
| Date | 2011-10-29 13:01 +0100 |
| Message-ID | <6kqna79sq2l3fm4n2gctuj3ns8gvo4jn0h@4ax.com> |
| In reply to | #9274 |
On Fri, 28 Oct 2011 16:07:52 +0200, Jaap Droogers
<JaapDroogers@unusable.meel.homelinux.net> wrote:
>On 28-10-11 15:46, schreef Roedy Green:
>> I wonder if anyone has ever looked at the byte code and/or the hotspot
>> code generated by code like this:
>>
>> final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ;
>>
>> vs:
>>
>> int count = lines *3;
>> if ( b1 ) count += 2;
>> if ( b2 ) count += 2;
>>
>> I wondered how clever it is. This is just curiosity. This is not
>> critical code.
>>
>> Which style do you prefer?
>
>The second: clean code!
>I don't like code that I don't understand at the first glance.
>Always use curly brackets:
>
>int count = lines *3;
>if ( b1 ) {
> count += 2;
>}
>if ( b2 ) {
> count += 2;
>}
>
>Don't try to do the optimizing work for the JIT compiler, she can handle
>it herself very good.
>
>Jaap Droogers
I always use the curly brackets, but don't always put them on separate
lines:
int count = lines *3;
if ( b1 ) { count += 2; }
if ( b2 ) { count += 2; }
I think that is easier to read when there is only one statement inside
the if.
$0.02
rossum
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-10-29 10:46 -0700 |
| Message-ID | <6394928.1369.1319910407533.JavaMail.geo-discussion-forums@prfk19> |
| In reply to | #9274 |
Jaap Droogers wrote:
> schreef Roedy Green:
>> I wonder if anyone has ever looked at the byte code and/or the hotspot
>> code generated by code like this:
>>
>> final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ;
>>
>> vs:
>>
>> int count = lines *3;
>> if ( b1 ) count += 2;
>> if ( b2 ) count += 2;
>>
>> I wondered how clever it is. This is just curiosity. This is not
>> critical code.
>>
>> Which style do you prefer?
>
> The second: clean code!
> I don't like code that I don't understand at the first glance.
> Always use curly brackets:
If you don't understand the ternary operator at first glance, the programming world should not use you as the bellwether of readability.
> int count = lines *3;
> if ( b1 ) {
> count += 2;
> }
> if ( b2 ) {
> count += 2;
> }
>
> Don't try to do the optimizing work for the JIT compiler, she can handle
> it herself very good.
Good advice.
--
Lew
[toc] | [prev] | [next] | [standalone]
| From | Henk van Voorthuijsen <voorth@xs4all.nl> |
|---|---|
| Date | 2011-10-28 08:05 -0700 |
| Message-ID | <885d93d2-213b-47c9-b524-0b4522ae469f@s9g2000yqi.googlegroups.com> |
| In reply to | #9273 |
On Oct 28, 3:46 pm, Roedy Green <see_webs...@mindprod.com.invalid> wrote: > I wonder if anyone has ever looked at the byte code and/or the hotspot > code generated by code like this: > > final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ; > > vs: > > int count = lines *3; > if ( b1 ) count += 2; > if ( b2 ) count += 2; > > I wondered how clever it is. This is just curiosity. This is not > critical code. > I prefer a third option: int count = lines * 3; count += b1 ? 2 : 0; count += b2 ? 2 : 0; Henk van Voorthuijsen
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> |
|---|---|
| Date | 2011-10-28 15:41 +0000 |
| Message-ID | <slrnjalj8c.6gl.avl@gamma.logic.tuwien.ac.at> |
| In reply to | #9275 |
Henk van Voorthuijsen <voorth@xs4all.nl> wrote:
> On Oct 28, 3:46 pm, Roedy Green <see_webs...@mindprod.com.invalid>
> wrote:
>> I wonder if anyone has ever looked at the byte code and/or the hotspot
>> code generated by code like this:
>> final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ;
>> vs:
>> int count = lines *3;
>> if ( b1 ) count += 2;
>> if ( b2 ) count += 2;
> I prefer a third option:
> int count = lines * 3;
> count += b1 ? 2 : 0;
> count += b2 ? 2 : 0;
I put forward an (N+1)st variant:
int b1Contrib = 0, b2Contrib = 0;
if (b1) { b1Contrib = 2; }
if (b2) { b2Contrib = 2; }
int count = lines * 3 + b1Contrib + b2Contrib;
doesn't look too exciting, but maybe would more so, if
b1Contrib and b2Contrib were renamed to something really
meaningful.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2011-10-28 10:31 -0700 |
| Message-ID | <0GBqq.2475$am1.448@newsfe05.iad> |
| In reply to | #9273 |
On 10/28/11 6:46 AM, Roedy Green wrote: > I wonder if anyone has ever looked at the byte code and/or the hotspot > code generated by code like this: > > final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ; > > vs: > > int count = lines *3; > if ( b1 ) count += 2; > if ( b2 ) count += 2; > > I wondered how clever it is. This is just curiosity. This is not > critical code. > > Which style do you prefer? If you're going for terseness or obscurity: final int count = lines * 3 + b1 != b2 ? 2 : b1 ? 4 : 0;
[toc] | [prev] | [next] | [standalone]
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
|---|---|
| Date | 2011-10-29 03:24 +0200 |
| Message-ID | <j8fkk1$eq7$1@dont-email.me> |
| In reply to | #9280 |
On 28/10/2011 19:31, Daniel Pitts allegedly wrote: > On 10/28/11 6:46 AM, Roedy Green wrote: >> I wonder if anyone has ever looked at the byte code and/or the hotspot >> code generated by code like this: >> >> final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ; >> >> vs: >> >> int count = lines *3; >> if ( b1 ) count += 2; >> if ( b2 ) count += 2; >> >> I wondered how clever it is. This is just curiosity. This is not >> critical code. >> >> Which style do you prefer? > > If you're going for terseness or obscurity: > > final int count = lines * 3 + b1 != b2 ? 2 : b1 ? 4 : 0; > '!=' is ugly for booleans. Make that a '^' and we have a winner. :) -- DF. Determinism trumps correctness.
[toc] | [prev] | [next] | [standalone]
| From | Wanja Gayk <brixomatic@yahoo.com> |
|---|---|
| Date | 2011-10-29 00:23 +0200 |
| Message-ID | <MPG.29154993d0220d239896ca@202.177.16.121> |
| In reply to | #9273 |
In article <29cla79dh934epr5n27cghvupjk77mpuqr@4ax.com>, see_website@mindprod.com.invalid says... > > I wonder if anyone has ever looked at the byte code and/or the hotspot > code generated by code like this: > > final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ; > > vs: > > int count = lines *3; > if ( b1 ) count += 2; > if ( b2 ) count += 2; > > I wondered how clever it is. This is just curiosity. This is not > critical code. > > Which style do you prefer? I personally don't care for the byte code unless it really matters, which is almost certainly never. So I concentrate on readability and code style. Among these two, I'd prefer the first variant for these reasons: It is obviously very clear that the value "count" won't change later in the program. It's short, concise and the brackets look like a "capsule" that wraps the decision being made. But if the term is getting too long, it might be a good idea to write this, which I find even more readable: final int v1 = b1 ? 2 : 0; final int v2 = b2 ? 2 : 0; final int count = lines * 3 + v1 + v2 ; Still I would try to find proper names for "v1", "v2", "b1" and "b2", like for example: final int optionalHeader = headerPrinted ? 2 : 0; final int optionalFooter = footerPrinted ? 2 : 0; final int count = lines * 3 + optionalFooter + optionalHeader; Kind regards, Wanja -- ..Alesi's problem was that the back of the car was jumping up and down dangerously - and I can assure you from having been teammate to Jean Alesi and knowing what kind of cars that he can pull up with, when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer] --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2011-10-29 10:50 -0700 |
| Message-ID | <11864467.903.1319910601187.JavaMail.geo-discussion-forums@prap37> |
| In reply to | #9287 |
Wanja Gayk wrote: > I personally don't care for the byte code unless it really matters, > which is almost certainly never. So I concentrate on readability and > code style. > Among these two, I'd prefer the first variant for these reasons: > It is obviously very clear that the value "count" won't change later in > the program. It's short, concise and the brackets look like a "capsule" > that wraps the decision being made. > But if the term is getting too long, it might be a good idea to write > this, which I find even more readable: > > final int v1 = b1 ? 2 : 0; > final int v2 = b2 ? 2 : 0; > final int count = lines * 3 + v1 + v2 ; > > Still I would try to find proper names for "v1", "v2", "b1" and "b2", > like for example: > > final int optionalHeader = headerPrinted ? 2 : 0; > final int optionalFooter = footerPrinted ? 2 : 0; > final int count = lines * 3 + optionalFooter + optionalHeader; +1 to all of the above. I'm immersed in style guidance these days, and that is some of the best style guidance I've seen. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Wanja Gayk <brixomatic@yahoo.com> |
|---|---|
| Date | 2011-11-01 13:36 +0100 |
| Message-ID | <MPG.291a0632c1a2e1fd9896cb@202.177.16.121> |
| In reply to | #9305 |
In article <11864467.903.1319910601187.JavaMail.geo-discussion- forums@prap37>, lewbloch@gmail.com says... > > Still I would try to find proper names for "v1", "v2", "b1" and "b2", > > like for example: > > > > final int optionalHeader = headerPrinted ? 2 : 0; > > final int optionalFooter = footerPrinted ? 2 : 0; > > final int count = lines * 3 + optionalFooter + optionalHeader; > > +1 > > to all of the above. > > I'm immersed in style guidance these days, and that is some of the best style guidance I've seen. Thank you. Kind regards, Wanja -- ..Alesi's problem was that the back of the car was jumping up and down dangerously - and I can assure you from having been teammate to Jean Alesi and knowing what kind of cars that he can pull up with, when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer] --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Michal Kleczek <kleku@poczta.onet.pl> |
|---|---|
| Date | 2011-10-31 17:38 +0100 |
| Message-ID | <j8miui$4ba$1@news.onet.pl> |
| In reply to | #9273 |
On 2011-10-28 15:46, Roedy Green wrote: > I wonder if anyone has ever looked at the byte code and/or the hotspot > code generated by code like this: > > final int count = lines * 3 + ( b1 ? 2 : 0 ) + ( b2 ? 2 : 0 ) ; > > vs: > > int count = lines *3; > if ( b1 ) count += 2; > if ( b2 ) count += 2; > They are not equivalent. > > Which style do you prefer? Contrary to most here I really like ternary conditional operator because of this little "final" modifier you have to omit in the second case. -- Michal
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.programmer
csiph-web