Wednesday, March 18, 2015

Digest for comp.lang.c++@googlegroups.com - 19 updates in 4 topics

ram@zedat.fu-berlin.de (Stefan Ram): Mar 18 10:37PM

> What's sad is how people are indoctrinated to
>focus on efficiency and flexibility.
 
Learning C++ is only worth the effort if one cares for efficiency.
 
For example, when one teaches rvalue references, what reason
should one give why someone has to learn this if not efficiency?
 
There are many other features in C++ only for the sake of efficiency.
Ian Collins <ian-news@hotmail.com>: Mar 18 04:52PM +1300

Richard wrote:
> and just convert that into 40 hrs/week, 52 weeks/year salary that
> includes benefits like health insurance, life insurance, disability
> insurance, etc.
 
Those of us who contract in civilised countries with decent public
healthcare get the best of both worlds!
 
--
Ian Collins
Christopher Pisz <nospam@notanaddress.com>: Mar 18 10:21AM -0500

On 3/17/2015 10:52 PM, Ian Collins wrote:
>> insurance, etc.
 
> Those of us who contract in civilised countries with decent public
> healthcare get the best of both worlds!
 
Where you living Ian? I want to get citizenship elsewhere before I die.
 
 
--
I have chosen to troll filter/ignore all subthreads containing the
words: "Rick C. Hodgins", "Flibble", and "Islam"
So, I won't be able to see or respond to any such messages
---
Ian Collins <ian-news@hotmail.com>: Mar 19 06:59AM +1300

Christopher Pisz wrote:
 
>> Those of us who contract in civilised countries with decent public
>> healthcare get the best of both worlds!
 
> Where you living Ian? I want to get citizenship elsewhere before I die.
 
New Zealand
 
--
Ian Collins
woodbrian77@gmail.com: Mar 18 11:26AM -0700

On Tuesday, March 17, 2015 at 10:52:48 PM UTC-5, Ian Collins wrote:
> > insurance, etc.
 
> Those of us who contract in civilised countries with decent public
> healthcare get the best of both worlds!
 
In the US we had a better healthcare before the
government got into it. I'm not sure why anyone
believed Obama when he said things like, "If you
like your doctor you can keep your doctor."
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
scott@slp53.sl.home (Scott Lurndal): Mar 18 07:40PM

>government got into it. I'm not sure why anyone
>believed Obama when he said things like, "If you
>like your doctor you can keep your doctor."
 
Please keep fucking politics out of this newsgroup.
 
You're wrong, btw.
woodbrian77@gmail.com: Mar 18 12:57PM -0700

On Wednesday, March 18, 2015 at 2:40:51 PM UTC-5, Scott Lurndal wrote:
 
Please don't swear here.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 18 07:59PM

> On Wednesday, March 18, 2015 at 2:40:51 PM UTC-5, Scott Lurndal wrote:
 
> Please don't swear here.
 
'This video may contain sexual swearwords, I'm afraid. There are 28
'fucks'. Including that one 29. Ah, fuck it, make it 30.' -- Paul Calf
 
/Flibble
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 18 08:40PM

On Wed, 18 Mar 2015 12:57:07 -0700 (PDT)
> On Wednesday, March 18, 2015 at 2:40:51 PM UTC-5, Scott Lurndal wrote:
 
> Please don't swear here.
 
Sorry this is a C++ newsgroup and not a politics newsgroup. If you
start posting off topic, then you have to take a few fucks in your
stride. There are plenty of news groups catering for right wing nut
jobs which are available to you.
 
Grow up a little why don't you?
 
Chris
Christopher Pisz <nospam@notanaddress.com>: Mar 18 04:42PM -0500

On 3/18/2015 3:40 PM, Chris Vine wrote:
 
> SNIP...groups catering for right wing nut jobs... SNIP
 
> Grow up a little why don't you?
 
> Chris
 
Are there no newsgroups catering to left wing nut jobs, centrist nut
jobs, or sane radicals?
 
I'm just joking around, but the statement you made seems a
little...what's the word? contrary, ironic, something or other..
 
 
 
--
I have chosen to troll filter/ignore all subthreads containing the
words: "Rick C. Hodgins", "Flibble", and "Islam"
So, I won't be able to see or respond to any such messages
---
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 18 10:25PM

On Wed, 18 Mar 2015 16:42:08 -0500
> jobs, or sane radicals?
 
> I'm just joking around, but the statement you made seems a
> little...what's the word? contrary, ironic, something or other..
 
I have missed your contrarian irony: I have no idea what you are talking
about. Brian appears to be neither a left wing nut job nor a centrist
nut job - unless you have evidence to the contrary I doubt such groups
would be to his taste.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Mar 18 09:43PM

On Sun, 2015-03-15, Glen Stark wrote:
...
> correctness, simplicity and clarity, you typically wind up with more
> flexible and efficient code than if you focus on efficiency and
> flexibility in advance. Sad but true.
 
Very true, but not sad. What's sad is how people are indoctrinated to
focus on efficiency and flexibility. I wonder why, since I've rarely
seen anyone gain anything by it. One or two guys selling books or
courses, but that's about it.
 
You get to spend more time writing and debugging lots of code, but I
suspect the increased risk of your company going bankrupt nullifies
that positive(?) effect.
 
[snip good advice]
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Luca Risolia <luca.risolia@linux-projects.org>: Mar 18 01:05AM +0100

Il 13/03/2015 06:53, BGB ha scritto:
> so, it may be more of a case of doing what works, rather than what is
> elegant or pretty.
 
"Elegance" is what makes C++'s sort() generic and faster than C's
qsort(), for example.
 
---
 
"The traditional mathematician recognizes and appreciates mathematical
elegance when he sees it. I propose to go one step further, and to
consider elegance an essential ingredient of mathematics: if it is
clumsy, it is not mathematics."
Edsger Dijkstra
BGB <cr88192@hotmail.com>: Mar 17 07:45PM -0500

On 3/17/2015 7:05 PM, Luca Risolia wrote:
>> elegant or pretty.
 
> "Elegance" is what makes C++'s sort() generic and faster than C's
> qsort(), for example.
 
typical C solutions:
copy-paste some code for a quicksort function and specialize it to the
data-structure on hand... ("screw generic"...).
 
 
or, maybe make a hairy mess of macros to allow a type-generic version of
something...
 
a few parameters might be passed into the macro, maybe a few special
defines to cause the macro to expand differently.
 
or, oh yeah, maybe put it in a special header where you use some magic
#define's to set some parameters and then #include it, and preprocessor
magic makes the specialized version of the code.
 
 
but, hell, it works...
 
 
actually, a hack/extension here (not available with the standard C
preprocessor, but can be glued on by a custom preprocessing stage,
feeding the output through a normal/sane compiler), is to support
block-macros and delayed/conditional preprocessor directives, ability to
update/assign define's, ..., so that one has essentially a turing
complete version of the C preprocessor.
 
actually, using something like this, it is possible to go as far as to
do something like a hairy/nasty set of Objective-C like extensions in
the preprocessor.
 
...
 
yes, I may or may not have such a beast...
 
( also may or may not have went and also applied this beast to trying to
write code in Java, because seriously, writing code in Java sucks this
bad sometimes... )
Ian Collins <ian-news@hotmail.com>: Mar 18 05:00PM +1300

BGB wrote:
 
> I am not sure how the software in a router or network appliance would
> compare with something like that used in industrial or robotics or
> automotive applications or similar.
 
Probably a lot more. Not so much in your typical ADSL router or
unmanaged layer 2 switch, but definitely when you get to high end layer
3 (or even 4) switches.
 
--
Ian Collins
Robert Wessel <robertwessel2@yahoo.com>: Mar 18 01:20AM -0500


>( also may or may not have went and also applied this beast to trying to
>write code in Java, because seriously, writing code in Java sucks this
>bad sometimes... )
 
 
And there's no reason a C compiler could not inline qsort() and the
comparison function if they were available to the compiler as
something closer to source than an object module. Which they may well
be, if the compiler supports link time code generation. Or if qsort
were defined in the header as a static inline function, and probably
the comparison function as well.
 
And didn't we already have this conversation back in 2010?
BGB <cr88192@hotmail.com>: Mar 18 01:33AM -0500

On 3/17/2015 11:00 PM, Ian Collins wrote:
 
> Probably a lot more. Not so much in your typical ADSL router or
> unmanaged layer 2 switch, but definitely when you get to high end layer
> 3 (or even 4) switches.
 
if you mean code complexity? dunno. I meant more in terms of development
practices and coding style...
 
 
I suspect that the combination of low hardware stats, tight timing
constraints, and limited dynamicism, different use-cases, ... may lead
to (potentially significant) differences in coding styles.
 
 
I can say though that, in terms of code size/complexity, most of my
robot stuff is pretty tiny vs, say, my 3D game engine.
 
as-is, it is something like a 25 kLOC control-program (14 kLOC of which
is for the VM/interpreter), vs roughly 1 MLOC for my 3D game engine.
 
 
in many ways, basic things aren't *that* different, but there is a lot
of more subtle differences. for example, timing and performance issues
weigh more heavily on the control program, and the 3D engine uses a big
main loop which does everything in a single big frame, and in the
control program, basically it became essentially just the scheduler
spinning at a high-speed, with pretty much everything else being done
incremental and asynchronously via scheduling events (with a much higher
emphasis on *when* things happen).
 
in both cases, there is some reliance on "plumbing pipe" logic, where
some logic sets function pointers to influence the path other logic
takes through the program (basically, the control-flow working sort of
like the green goo in pipe-dream, with logic updating the paths of the
function-pointers to locally optimize the performance).
 
this is partly based on my experiences earlier on with interpreters,
where it had been noted that dynamically building paths for things which
were semi-stable was often faster than reliance of winding if/else trees
or switches (often the cost of figuring out how to get to where
something needed to be done was considerably more expensive than just
doing so, and function pointers will often allow reaching the target
logic more efficiently).
 
 
otherwise, do remember before looking at an industrial controller, which
was $2k for a device with with, apparently:
128MB of RAM, 256MB Flash;
266MHz processor;
-40C to 85C temperature range;
30g maximum shock, 5g continuous vibration resistance.
 
however, a lot of this stuff is also water and corrosion resistant. for
example, boards will often be coated in an hard rubbery coating, and
often have hydrophobic coatings on the exposed metal parts. like, the
idea is so that they wont be damaged if someone goes and sprays the
equipment with a pressure washer or similar...
 
say a MOBO that was like this, basically what would be an otherwise
generic and cheap PC MOBO (few fancy features, IIRC a permanently
mounted processor, ...), just "ruggedized" and with a GPIO interface and
similar, had "crazy expensive" prices (basically, just this was higher
than the cost of a high-end PC).
 
like, a person could probably rubber-coat and apply hydrophobic coatings
and similar themselves for probably a fraction of this cost.
 
 
actually, a lot of industrial stuff is sort of this way:
seemingly ridiculously overbuilt vs more mundane alternatives, and also
rather expensive and with otherwise rather bad hardware stats (for its
size and cost).
 
 
but, I guess a drawback of cheaper/faster boards is that they are
basically screwed if they go into water (or maybe get continuously
exposed to vaporized hydraulic fluid or similar?...).
 
but, I guess some people in RC circles go and apply water and corrosion
resistant coatings themselves (ex: CorrosionX and similar), and other
people have gone and basically treated their boards with clear silicone
caulk or similar to make them waterproof (though, people also go and
stress the importance of using non-acid-cure caulk as well, where
typical silicone caulk releases acetic acid as it cures, but you don't
want this for electronics).
 
I guess, maybe if a person wanted they could go and try to ruggedize and
waterproof an RPi or similar...
 
 
I think I mentioned already that some of my recent electronics were
actually wired up to run under-water, though this was something pretty
small/trivial, briefly visible here:
https://www.youtube.com/watch?v=oxmHWUzDCwE
 
yes, basically point-to-point wiring insulated with silicone caulk
(errm, of the acid producing variety, but oh well, hope it holds up),
built as a small analog device to control power given to the motor for
testing purposes...
 
but, why submerged in water: because this use-case makes enough heat
that air-cooling doesn't work so well.
 
under load, it basically gets hot enough that slight boiling starts
occurring (steam bubbles start forming and rising off the transistors).
 
but, in this case, this seemed to be the simplest and cheapest option...
even maybe if it is tacky to do water-cooled electronics in this way...
BGB <cr88192@hotmail.com>: Mar 18 01:41AM -0500

On 3/18/2015 1:20 AM, Robert Wessel wrote:
> were defined in the header as a static inline function, and probably
> the comparison function as well.
 
> And didn't we already have this conversation back in 2010?
 
us specifically?... I don't remember, 2010 was a long time ago...
 
 
but, yeah, static inlines are good, I use these a lot as well, generally
to good effect.
 
didn't think of this in this case.
 
I guess a possible issue is things like how smart the compiler is about
fixed-size memcpy and similar (like, if it can handle it as a builtin
function, or just naively always calls a library version...).
 
 
but, yeah, I suspect copy/paste/specialize is probably still one of the
most common solutions for this sort of thing, at least in C land...
Jorgen Grahn <grahn+nntp@snipabacken.se>: Mar 18 09:22PM

On Mon, 2015-03-16, BGB wrote:
>> and 20 cores ;-)
 
> yes, but I suspect these sort of things may not necessarily be what one
> normally thinks of as "embedded".
 
I do, and so does Martijn it seems. But yes, it has been established
here (and in comp.lang.c) countless times, that noone can agree on
what's "embedded".
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: