C++ syntax without C++ - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: C++ syntax without C++

Quoted text here. Click to load it

It was openocd and a STM32F discovery board as the JTAG-SWD adapter. I
only noticed the ability with the SWD stuff, after many years on ARM7
JTAG.

Quoted text here. Click to load it

It's very nice, to the extent that I start to organise my code to take
advantage. Like having all the variables for a module in a structure
("class?") so I can see them all at once. And it turns out this is more
efficient anyway. The code is starting to look more and more like a
basic C++. All the functions passing around a pointer to the shared data
structure. I should call it "this". :)



--  

John Devereux

Re: C++ syntax without C++
On 07/11/13 18:46, John Devereux wrote:
Quoted text here. Click to load it

I was doing that kind of thing in 1983, plus function pointer
in the object as well. I'm sure that if I'd had too many objects
of one type then I would have replaced the function pointers with
a pointer to the struct of function pointers.

Who needs C++ when C-with-classes gets you 90% of the benefit? :)


Re: C++ syntax without C++
David Brown wrote:

[...]

Quoted text here. Click to load it

I try to keep debugging separate. iSYSTEM (offering a 50$ solution for
gcc-ARM or working with "free" J-Link), Lauterbach...

But I never tried it with C++.

Oliver
--  
Oliver Betz, Munich
despammed.com is broken, use Reply-To:

Re: C++ syntax without C++
On 06/11/13 14:10, David Brown wrote:
Quoted text here. Click to load it

If you only pick small problems with limited lifetimes,
then I agree the problem is much reduced.

But C++'s raison d'etre was to enable reliable construction
of large programs with a long lifetime.

Quoted text here. Click to load it

That's a revealing statement, in that it implies what you
haven't tried to do with C++.


Quoted text here. Click to load it

Which will enable you to find different problems, and ones which are
far less tractable :(

Quoted text here. Click to load it

What's the current position on "casting away constness"?

(In the early 90s the apparent impossibility of getting all the
language experts to agree the "right answer" was one of the
reasons I gave up on C++.)




Re: C++ syntax without C++
On 06/11/13 16:55, Tom Gardner wrote:
Quoted text here. Click to load it

True enough - but if you can use some features of C++ to give you better
code along your way to that goal, then that's a good thing.  If you try
to grasp over too much C++ too quickly, or over-use it, you can quickly
end up with lasagne code.  I have seen such code in practice, with so
many delegates, proxies, factories, handlers and so on that it was very
difficult to find any code that actually did any /useful/ work!

Developers and development teams need to pick a balance that suits them
and their way of working - we are all different in that way.

Quoted text here. Click to load it

Yes, that's true (I probably wasn't very clear on that).  I have not
used C++ for any serious embedded system as yet - I've used it for small
test systems, I've used it on desktops, I've done "compile and examine
the assembly" experiments on a few different targets, and I have worked
with customers' programs in C++ (debugging, enhancing, writing low-level
parts, etc.) on several targets.  But I have not yet used it for serious
development work on my own embedded projects.  However, I hope to do so
in the near future - as I said, the language, the tools, and the target
micros that we use are getting to the point where C++ will be a better
choice than plain C.

Another issue that limits me, personally, from using C++ much in real
projects is that I /do/ like to know all about a language and the tools
before using them.  The idea of learning and using the language piece by
piece can work very well for some people (that's why I suggested it as
an option), but I know that I prefer to understand a lot more, and
experiment a lot more, before using it in real code.  I want to get
things like that Uart template class in place and study the exact
generated assembly code from it on different targets.  That means a lot
of homework, because I can't justify doing much of that sort of thing on
paid time (paid time work should be "good enough", not wasted on aiming
for "perfect").


All this means that my experience of writing C++ is limited, and I
haven't designed my own big C++ systems.  If someone needs advice on
that, then I am not the best person to help (though I can tell you what
/not/ to do, having seen mistakes made by others) - and comp.lang.c++
may be better than c.a.e.  But here we have been discussing the
low-level parts and the generated code - and I have look at that sort of
thing more than a lot of people.  Programmers who learned C++ first will
have far more experience than me at C++ programming - but are seldom
very keen on reading the generated ARM (or whatever) assembly with a
view to getting near-optimal object code.



Quoted text here. Click to load it

There will always be problems of some sort - the job would be boring
without them!

I understand your point, however.

Quoted text here. Click to load it

I don't know about any general "current position" here, but I would say
it is best avoided when possible - just like with C.  I like to use
const when I can.  Sometimes in C++ that can lead to duplicated code
when you need to write the same member function in a "const" and "not
const" version.  I don't know any good way around that.



Re: C++ syntax without C++
On 06/11/13 12:34, David Brown wrote:
Quoted text here. Click to load it

It is worse than that. You have to understand which /implementation/
you are using and, as you yourself indicate below, even which version of
each implementation.


Quoted text here. Click to load it

And just how do you know exactly how far it is safe to push? The
bugs caused by the "next push" of optimisation will of course
be subtle, infrequent and very hard to spot.


Quoted text here. Click to load it

And I can understand that some programmers don't realise just how
ambiguous parts of the standard are!


Quoted text here. Click to load it

The trouble is that most programmers are in that position :(
Even highly experienced and intelligent ones :(


 >>> Join the world of C99 - it's only 15 years old.
 >>
 >> And there has been at least one C++ compiler
 >> for 2/3 of that time :( (As opposed to a myriad
 >> of compilers which support different subsets of
 >> C++)
 >>
 >> Is there a *complete* C++11 compiler yet?
 >> One that the vast majority of people regard
 >> as complete?
 >
 > gcc (from around gcc 4.5 for a lot of the useful features

So that was a "no" then. Thanks for making my point.


 > - before C++11
 > was finish, and more complete support with later versions).

And still is a "no". Thanks for making my point a second time.


 > <http://gcc.gnu.org/projects/cxx0x.html
 >
 > Of course, there is always a question of how complete is "complete" -

Complete is a binary attribute, not a grayscale adjective!
Unless you are prepared to argue that grey is white :)


 > there are not many compilers that /fully/ implement all of C99.

And more interestingly, it appears there *never can be*. Why?
Because, according to some that have sat on the standardisation
committee, even the committee can't agree within themselves
what some parts mean and how different parts interact! Sometimes
they thought they did -- until a third party got person X to explain
feature F to person Y, and vice versa. At which point X and Y
realised they had a different valid understandings!


 > But I think gcc C++11 was "complete" in your sense by 4.7.

??? I really don't see how you can believe that!


 >>> I am surprised that you are regurgitating the decades old anti-C++
 >>> propaganda, while missing the "big" points.
 >>
 >> I think you are missing different "big points".
 >
 > Perhaps that's true, and if you know of others that are not mentioned
 > then bring them up.  I think some of /my/ "big points" can be
 > show-stoppers on the choice of C++ for embedded development projects,
 > while I did not see anything serious in the OP's original worries, and I
 > don't see /your/ worries about optimisations interacting with subtle
 > bugs as a big point.

And you have neatly failed to address some of my points.


Re: C++ syntax without C++
Hi Tom,

On 11/6/2013 8:32 AM, Tom Gardner wrote:

Quoted text here. Click to load it

Years ago, I was reading one of Stroustrup's C++ books.  I had to
keep RE-reading a section (a few pages) as it seemed entirely
WRONG to me.  Yet, here's the guy who created the language...
surely the problem must be one of comprehension (lack thereof)
on my part!

No, it's not a "typo" -- he is taking a consistent position and
repeating it.  "What am I missing?"

I finally took the opportunity to write to him -- humbly citing
chapter and verse and explaining my dismay at failing to
understand (or agree with) his points:  "What am I missing?"

His reply:  everything he had written was WRONG.  (WTF?  Surely *you*
with the most experience in YOUR creation...)

What does that say about those of us who are less experienced, less
disciplined, less invested or less intelligent?  People who imperfectly
know something inevitably make mistakes.  People who aren't "motivated"
don't CARE about their mistakes.  Presumably, Bjarne was neither -- yet
still made a glaring mistake -- and printed tens of thousands? of
copies thereof!  (apparently coming as a surprise to him as he didn't
indicate it was a "previously reported error")

I am perpetually drawn back to
    complex:  adj., too large to fit in a single human brain
(perhaps conditioned by "while leaving room for other 'important'
things" as a reference to Kelly Bundy)

Re: C++ syntax without C++
On 6.11.13 9:44 , Don Y wrote:
Quoted text here. Click to load it


C++ is a monster, it is a bastard between object-oriented language
and a non-object language. It is having symptoms of PL/1 which was
a victim of its versatility.

--  

Tauno Voipio


Re: C++ syntax without C++
Hi Tauno,

On 11/6/2013 1:06 PM, Tauno Voipio wrote:

Quoted text here. Click to load it

Have a look at Ada if you really want to be intimidated!  :<

If you make a tool and no one can use it effecvely/efficieny,
I contend that you've made the wrong tool!  (imagine if a
HAMMER required you to wear a special suit and use a special
*holder* in order to employ it.  You'd see lots of shiney
new hammers sitting on the bench collecting dust -- and lots
of people carrying large ROCKS in their toolkits!  :> )

I was particularly dismayed to see the approach Ritchie et al.
took with Limbo/Inferno -- *knowing* how successful C had been and
all the "issues" with C++.  It would be interesting to have a
*candid* conversation with any of them on that topic.

Perhaps their attitude was "it's just a job"?  <shrug>

Ada and Wirth languages, was: Re: C++ syntax without C++
Quoted text here. Click to load it

Ada's got a lot of functionality in it, and can seem unwieldly and
bloated at times as a result (especially to newcomers) and the
language maintainers seem intent on adding more and more in recent
versions, but there is still a core language there which is still
usable and reasonably easy to understand.

I really like what is at the core of Ada (and I like Wirth style
languages in general) but at times it seems like the Ada language
maintainers are trying to justify their own jobs by adding more
and more functionality into the Ada standards.

However, none of that changes the fact there is a good core language
within Ada which is still as usable as always.

In some ways, I like the approach Wirth has taken with the Oberon
variants in which he (and his students) have created various
language variants with only the core features remaining.

Simon.

--  
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

Re: Ada and Wirth languages, was: Re: C++ syntax without C++
Hi Simon,

On 11/6/2013 3:04 PM, Simon Clubley wrote:

Quoted text here. Click to load it

The idea/concepts are (reasonably) self consistent.  It's just
the sheer *volume* of material that confronts you that makes it
intimidating.  "How do I print 'Hello, World!'?  Where do I *start*
to look for this information?"

(sure, there are lots of texts that can lead you through the
language.  OTOH, if you pick up The (original) C Standard, you
can figure this out for yourself in something less than a fortnight!)

Quoted text here. Click to load it

Think of where it is used as an answer to that musing!  :>  If it was
easy, EVERYBODY would be doing (using) it!  :-/

Quoted text here. Click to load it

I like small languages where you can hone your understanding of
a few ideas -- instead of having to master lots of detail (much
of which you may never use!).

E.g., when I design "logic", I tend to use a few parts/modules
over and over again.  Can I save a bit by optimizing a particular
instantiation somewhere?  Yes.  But, is it worth remembering
N different forms of a particular "component"/module?  Will
the next guy appreciate *why* I chose this, here -- and not
*that*?  Do I want to distract him by making changes that don't
significantly influence the result?  (i.e., I would rather use
a "change" to alert the next guy that "something DIFFERENT is
happening over here!  Pay attention!")

Re: Ada and Wirth languages, was: Re: C++ syntax without C++
Am Wed, 6 Nov 2013 22:04:43 +0000 (UTC) schrieb Simon Clubley:

Quoted text here. Click to load it

Me too. And Oberon is available for free and for everyone, not only for
Wirths students. But seems the future development merged over to
Zonnon, which i believe is not a real "Wirth language" anymore.

comp.lang.oberon
http://www.oberon.ethz.ch/
http://www.zonnon.ethz.ch/
http://www.mathematik.uni-ulm.de/oberon/

Greets, Andreas Baumgartner

Re: Ada and Wirth languages, was: Re: C++ syntax without C++
Quoted text here. Click to load it

Thanks for reminding me about Zonnon.

I've just had a look at it and it appears to require a .Net/Mono
environment which is unfortunate.

Still, I'll have a read through the language report to see what new
good ideas might be in there...

Simon.

--  
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

Re: Ada and Wirth languages
Simon Clubley wrote:

Quoted text here. Click to load it

Considering that the ARG (the Ada language maintainers) is operating on
a volunteer basis, that reason doesn't seem likely.

Greetings,

Jacob
--  
»You have to blow things up to get anything useful.«
                                  -- Archchancellor Ridcully

Re: Ada and Wirth languages
On 07/11/13 08:13, Jacob Sparre Andersen wrote:
Quoted text here. Click to load it

Some people get their ego-boosts and reputation-boosts via such means.
Some people have their corporate performance reviews enhanced by saying
"I am on committee X".

I have no knowledge of the Ada committees whatsoever.


Re: Ada and Wirth languages
Quoted text here. Click to load it

Exactly. Just because it's not a (directly) paid job, that doesn't mean
it's not considered to be a job for a number of purposes.

I actually had a what-the-hell moment a few weeks ago over in comp.lang.ada.
There was a reference to a tricky part (I forget which part) of the Ada
standard which was apparently difficult to implement in a Ada compiler and
the people involved in the process seemed amused by that.

My internal reaction was basically; What the hell ??? You people are
actually proud of that ??? That's the kind of thing that goes on in C++
land, not in something built around the principals Ada was built around. :-(

(I never actually posted that in response, although I was seriously
tempted to.)

Make a standard easy to implement and you are more likely to get
consistant and robust compilers. Go all macho while drafting your
standards and you end up with code that's going to have different
behaviour between compilers.

At the core of Ada is a good, well defined, language. I hope the people
responsible for it's development don't lose sight of that.

Simon.

--  
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

Re: Ada and Wirth languages
Hi Simon,

On 11/7/2013 6:49 AM, Simon Clubley wrote:

Quoted text here. Click to load it

There are obvious, unspoken incentives to NOT making things simple.
"If it was easy, EVERYONE would/could be doing it -- what role do
*I* serve??"

You see this often with "consultants" -- coming up with solutions
that effectively "ensure job security".  I take the opposite
approach (because I consider having to revisit something to be a
"chore" -- like mowing the lawn... AGAIN!)

This can be perverse!  E.g., there will ALWAYS be police -- because
there is no incentive for them to "do away with crime" and, thus,
their own jobs!  :>  (tongue-in-cheek)

I had a colleague who had a great take on this!  He was in charge
of quality.  He would openly state that his goal was to make his
job obsolete!  I.e., to improvethe process(es) to the point where
quality was *inherent* in everything.  A lofty goal, of course.
But, consider the opposite attitude:  that of "traffic cop".

If you *don't* need a language lawyer to understand a language, then
what role does the language lawyer have, going forward?  :>

Quoted text here. Click to load it

But, "job security" (again, tongue in cheek)

Re: Ada and Wirth languages
"Jacob Sparre Andersen"  wrote in message  
Quoted text here. Click to load it

There area other forms of "pay" than money.

    - Bill


Re: C++ syntax without C++
On 06/11/13 20:44, Don Y wrote:
Quoted text here. Click to load it

Have you never found that the users of your products understand it
better that you, as the creator?  I know I certainly have.  And for
something as complex as a programming language, and with so many users
(and readers of his book), it would be very surprising if other people
didn't find mistakes or better solutions.



Re: C++ syntax without C++
On 07/11/13 12:19, David Brown wrote:
Quoted text here. Click to load it

If "they" take "it" and are able to use it /successfully/
to solve problems you didn't know about -- that's wonderful

If "they" take "it" and are /accidentally/ able to do things
that /subtly/ fail to solve their problems -- that's awful.


Site Timeline