Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #27265

Re: Embedded platforms for beginners?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.arch.embedded
Subject Re: Embedded platforms for beginners?
Date 2017-09-06 10:24 +0200
Organization A noiseless patient Spider
Message-ID <ooobcm$c6d$1@dont-email.me> (permalink)
References (11 earlier) <87o9qrm3xw.fsf@nightsong.com> <CV5rB.34451$WI2.28011@fx38.iad> <oom4gs$57r$1@dont-email.me> <b0jtqctem62cf5ue86k91n6pii7she0atb@4ax.com> <oomlbt$49i$1@dont-email.me>

Show all headers | View raw


On 05/09/17 19:02, Rob Gaddi wrote:
> On 09/05/2017 09:35 AM, George Neuner wrote:
>> Unfortunately, the pro-GC bias is one that is firmly rooted in
>> reality.
>>
>> In this forum we get a distorted view because the general skill level
>> of embedded developers is relatively high.
>>
>> In the broader programming world, the average skill level is just
>> slightly above "script kiddy".  The headlong march to "managed"
>> languages such as Java, C#, Python, etc. is industry acknowledging
>> that the average programmer simply can't write a complex program
>> without hand-holding.
>>
> 
> I used to write a lot of assembly.  Then I wrote a lot of C.  These days
> I write a lot of Python.  And you know what?  I get more done faster
> with fewer bugs.
> 
> Just the same as going from ASM to C, there are things that the machine
> is just better at doing than you are.  Here and there, yeah, I can sit
> there and hand-tweak better ASM than the C compiler will give me.  But
> for an entire project of any scope?  Better to let the optimizing
> compiler do 90% of the job over 100% of the project than for me to do
> 100% of the job over only 20% of the project.

Agreed.

> 
> GC is the same thing.  Think how complicated the simple function "Create
> a new string from the concatenation of two existing strings." becomes
> when you start having worry about malloc/free.  Either:
>   A) the function has to accept a pre-allocated buffer, in which case
> you've moved all the complexity of adding strlens and not getting off by
> one out of the function, making the function pointless, or
>   B) the function does its own malloc, which you've now hidden under the
> hood while still forcing the caller to remember to free it at some point.
> 

Anyone working in C with malloc/free for code that does a lot of string
work, is working in the wrong language.  Even though you can hide the
malloc's and frees in wrappers that make it easier to track, it is still
immensely painful - at best, you are using function-call syntax instead
of infix operators and writing code that is hard to follow.

> With GC if you need the new string, you magically create it on the heap,
> and then you walk away, comfortable in the knowledge that it'll get
> taken care of.

Garbage collection is /not/ needed for this - though it is certainly one
way to do it.  C++'s model works fine:
#include <iostream>
#include <string>
#include <stdlib.h>

using namespace std::string_literals;

int main(void) {
	auto s = "Equation: "s;
	auto t = u8"πr²"s;
	
	std::cout << (s + t + "\n");
}

No leaks, no problem using strings just like in Python, and no garbage
collection.


Of course, the C++ model has its own advantages and disadvantages, just
like the C malloc/free, and just like any given garbage collection method.


> 
>> And it isn't just memory management ... the runtimes of these
>> languages also - in whole or in part - manage files, network
>> connections, threads, synchronize object access, etc.
>>
> Having tools to make the routine parts of the job easier so that you can
> concentrate on the larger problem is a good thing.
> 
>> C isn't even being taught in a lot of schools now, so even those who
>> have a (relatively) recent CS/IS degree may have no experience of
>> programming that requires manual resource management.
>>
>>
>> All in all, general software development is a sorry state of affairs
>> that is getting worse with every passing year.  I have stated in the
>> past my belief that the majority of software "developers" would be
>> doing the world a favor by finding another occupation.
>>
>> YMMV,
>> George
>>
> 
> 

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Embedded platforms for beginners? Elof Huang <elof.huang@runbox.com> - 2017-09-01 14:07 +0800
  Re: Embedded platforms for beginners? Jack <jack4747@gmail.com> - 2017-08-31 23:22 -0700
  Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-01 04:10 -0400
  Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-01 21:49 +1000
    Re: Embedded platforms for beginners? Elof Huang <elof.huang@runbox.com> - 2017-09-02 11:57 +0800
      Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-02 18:25 +1000
        Re: Embedded platforms for beginners? Elof Huang <elof.huang@runbox.com> - 2017-09-03 15:37 +0800
          Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-03 17:54 +1000
          Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-03 13:49 -0400
    Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-02 11:41 -0400
      Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-03 09:44 +1000
        Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-02 20:39 -0400
          Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-03 11:16 +1000
        Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-02 18:21 -0700
          Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-03 14:26 +1000
            Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-03 02:14 -0400
              Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-03 17:52 +1000
                Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-03 13:50 -0400
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-03 22:20 -0700
                Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-05 22:06 -0400
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-06 12:21 +1000
                Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-05 22:42 -0400
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-06 14:26 +1000
                Re: Embedded platforms for beginners? rickman <gnuarm@gmail.com> - 2017-09-06 01:20 -0400
                Re: Embedded platforms for beginners? George Neuner <gneuner2@comcast.net> - 2017-09-03 15:58 -0400
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-04 08:00 +1000
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-03 19:13 -0400
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-04 09:58 +1000
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-03 20:16 -0400
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-04 15:13 +1000
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-03 22:24 -0700
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-04 15:55 +1000
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-05 14:15 +0200
                Re: Embedded platforms for beginners? George Neuner <gneuner2@comcast.net> - 2017-09-05 12:35 -0400
                Re: Embedded platforms for beginners? Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2017-09-05 10:02 -0700
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-05 18:13 +0100
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-06 10:24 +0200
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-05 17:10 -0700
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-06 09:57 +0200
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-05 16:57 -0700
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-05 16:54 -0700
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-06 12:31 +1000
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-05 19:42 -0700
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-05 10:16 +0200
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-05 16:56 -0400
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-04 10:46 +0100
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-05 17:09 -0400
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-05 19:35 -0700
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-06 12:40 +1000
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-06 00:42 -0400
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-06 08:55 +0100
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-06 08:45 +0100
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-07 20:23 -0400
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-08 08:42 +0100
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-08 12:07 +0200
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-08 11:40 +0100
                Re: Embedded platforms for beginners? David Brown <david.brown@hesbynett.no> - 2017-09-08 13:24 +0200
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-08 13:36 +0100
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-09 13:16 -0400
                Re: Embedded platforms for beginners? Les Cargill <lcargill99@comcast.com> - 2017-09-10 08:53 -0500
                Re: Embedded platforms for beginners? Dimiter_Popoff <dp@tgi-sci.com> - 2017-09-10 20:18 +0300
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-11 21:24 -0400
                Re: Embedded platforms for beginners? Les Cargill <lcargill99@comcast.com> - 2017-09-15 22:22 -0500
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-18 11:26 -0400
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-18 18:26 +0100
                Re: Embedded platforms for beginners? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2017-09-19 14:27 -0400
                Re: Embedded platforms for beginners? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-09-18 18:24 +0100
                Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-03 22:30 -0700
                Re: Embedded platforms for beginners? Clifford Heath <no.spam@please.net> - 2017-09-04 15:51 +1000
            Re: Embedded platforms for beginners? Paul Rubin <no.email@nospam.invalid> - 2017-09-03 22:04 -0700
      Re: Embedded platforms for beginners? kristoff <kristoff@skypro.be> - 2017-09-05 17:56 +0200
        Re: Embedded platforms for beginners? Luke A. Guest <laguest@archeia.com> - 2017-09-10 17:10 +0100
  Re: Embedded platforms for beginners? tarjei99@gmail.com - 2017-09-10 05:49 -0700
    Re: Embedded platforms for beginners? Les Cargill <lcargill99@comcast.com> - 2017-09-10 09:03 -0500

csiph-web