Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #384946
| From | moroney@world.std.spaamtrap.com (Michael Moroney) |
|---|---|
| Newsgroups | comp.os.linux.advocacy, sci.physics |
| Subject | Re: Loop(100) |
| Date | 2016-12-19 17:20 +0000 |
| Organization | The World : www.TheWorld.com : Since 1989 |
| Message-ID | <o394s3$e6h$3@pcls7.std.com> (permalink) |
| References | <f55d5858-3f4b-4644-871e-06d06439a2b5@googlegroups.com> <Jeff-Relf.Me@Dec.17--0.34P.Seattle.2016> |
Cross-posted to 2 groups.
Jeff-Relf.Me <@.> writes: >Incubus wrote: >> for (int i = 0; i < 100; ++i) >> [...] >> What is the advantage of using '++i' instead of 'i++' ? >I see no need to optimize integer increments. A good compiler will optimize better than you can, anyway. >My loops look like this: ... >Given: > #define Loop( N ) int LLL = ( N ), J = -1 ; while ( ++J < LLL ) A tiny example of the type of bizarre coding styles I've had to deal with that makes code difficult to maintain. This is quite minor and if I had to maintain code where this was the only strange coding example in it, I'd actually be relieved/happy. Add in a bunch of other oddball stuff and it becomes hard to follow. But for grins, I'll ask you, why not a "for (J=0; J < LLL; J++)" based construct which was designed for such loops? And what was the advantage of "J = -1; while ( ++J ..." where the intent was to go through the loop with J == 0 the first time. I see no reason other than to confuse the next guy. Maybe job security for you? A good compiler will optimize the assign to -1 away to a clear, on hardware where a clear/set to 0 is a bit faster than setting to a nonzero constant. That's irrelevant unless the loop itself was in a larger loop and the code was being squeezed for every microsecond.
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Technical challenge for DFS Incubus <incubus9536612@gmail.com> - 2016-12-16 07:18 -0800
Re: Technical challenge for DFS DFS <nospam@dfs.com> - 2016-12-16 11:32 -0500
Re: Technical challenge for DFS DFS <nospam@dfs.com> - 2016-12-16 11:37 -0500
Re: Technical challenge for DFS Incubus <incubus9536612@gmail.com> - 2016-12-16 08:50 -0800
Re: Technical challenge for DFS Steve Carroll <fretwizzer@gmail.com> - 2016-12-16 09:32 -0800
Loop(100) Jeff-Relf.Me <@.> - 2016-12-17 12:34 -0800
Re: Loop(100) DFS <nospam@dfs.com> - 2016-12-18 00:44 -0500
Command Line jockies use plenty of aliases, no ? ! Jeff-Relf.Me <@.> - 2016-12-17 21:59 -0800
Re: Loop(100) moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-19 17:20 +0000
I don't worry about "optimizations", don't need to. Jeff-Relf.Me <@.> - 2016-12-19 10:56 -0800
Re: I don't worry about "optimizations", don't need to. Steve Carroll <fretwizzer@gmail.com> - 2016-12-19 11:23 -0800
Re: I don't worry about "optimizations", don't need to. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-20 12:30 +0000
Other people's code is hard to learn/modify. Jeff-Relf.Me <@.> - 2016-12-20 06:06 -0800
Re: Other people's code is hard to learn/modify. Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-12-20 15:31 +0100
Re: Other people's code is hard to learn/modify. chrisv <chrisv@nospam.invalid> - 2016-12-20 09:04 -0600
Re: Other people's code is hard to learn/modify. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-20 15:06 +0000
What The Fuck is wrong with your peers ? ! Jeff-Relf.Me <@.> - 2016-12-20 09:59 -0800
Re: What The Fuck is wrong with your peers ? ! moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-20 23:22 +0000
I won, bigly. Jeff-Relf.Me <@.> - 2016-12-20 16:15 -0800
Re: I won, bigly. DFS <nospam@dfs.com> - 2016-12-21 00:01 -0500
AutoFormatting hides the fingerprints. Jeff-Relf.Me <@.> - 2016-12-21 02:55 -0800
Re: AutoFormatting hides the fingerprints. Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-12-21 14:33 +0100
Re: AutoFormatting hides the fingerprints. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-22 03:21 +0000
My code is dense, and hard to read, like the Washington Post. Jeff-Relf.Me <@.> - 2016-12-22 02:36 -0800
Re: My code is dense, and hard to read, like the Washington Post. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-22 21:22 +0000
Re: My code is dense, and hard to read, like the Washington Post. chrisv <chrisv@nospam.invalid> - 2016-12-23 07:54 -0600
Re: My code is dense, and hard to read, like the Washington Post. flatfish+++ <flatfish@linuxmail.org> - 2016-12-23 09:35 -0500
Re: My code is dense, and hard to read, like the Washington Post. Marek Novotny <marek.novotny@marspolar.com> - 2016-12-23 08:46 -0600
Re: My code is dense, and hard to read, like the Washington Post. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-23 16:21 +0000
My code is dense, and hard to read, like the Washington Post. Jeff-Relf.Me <@.> - 2016-12-23 08:52 -0800
Re: My code is dense, and hard to read, like the Washington Post. moroney@world.std.spaamtrap.com (Michael Moroney) - 2016-12-23 19:12 +0000
Re: My code is dense, and hard to read, like the Washington Post. chrisv <chrisv@nospam.invalid> - 2016-12-23 13:27 -0600
Re: My code is dense, and hard to read, like the Washington Post. Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-12-23 20:56 +0100
Re: My code is dense, and hard to read, like the Washington Post. Snit <usenet@gallopinginsanity.com> - 2016-12-23 13:32 -0700
Re: My code is dense, and hard to read, like the Washington Post. Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-12-23 22:40 +0100
Re: My code is dense, and hard to read, like the Washington Post. Snit <usenet@gallopinginsanity.com> - 2016-12-23 15:19 -0700
Re: My code is dense, and hard to read, like the Washington Post. Steve Carroll <fretwizzer@gmail.com> - 2016-12-23 14:30 -0800
My C++ Coding Standards ( apologies to Bjarne Stroustrup ). Jeff-Relf.Me <@.> - 2016-12-23 17:06 -0800
Re: My C++ Coding Standards ( apologies to Bjarne Stroustrup ). Peter Köhlmann <peter-koehlmann@t-online.de> - 2016-12-24 10:40 +0100
Re: My code is dense, and hard to read, like the Washington Post. jmfbahciv <See.above@aol.com> - 2016-12-24 14:04 +0000
Someday, if you're lucky, you'll know the freedoms I enjoy. Jeff-Relf.Me <@.> - 2016-12-23 08:05 -0800
Re: My code is dense, and hard to read, like the Washington Post. GreyCloud <mist@cumulus.com> - 2016-12-23 13:49 -0700
Re: I won, bigly. Silver Slimer <.m@nsn.s> - 2016-12-21 09:09 -0500
Re: I won, bigly. benj <benj@nobody.net> - 2016-12-21 17:37 -0500
Re: What The Fuck is wrong with your peers ? ! chrisv <chrisv@nospam.invalid> - 2016-12-21 07:14 -0600
csiph-web