J
jacob navia
Memory footprint. C++ uses up a LOT of memory.
Memory footprint. C++ uses up a LOT of memory.
Memory footprint. C++ uses up a LOT of memory.
That's because it's incremented. Higher value integers use up more memory.
jacob navia said:Memory footprint. C++ uses up a LOT of memory.
I haven't noticed such a difference.
(In fact, there are many cases where C consumes more memory than the
equivalent C++ version because often C++ allows the compiler to perform
optimizations that the C compiler cannot do.)
Well there are limits, and those limits are set by our brain. In the
last resort, mere PEOPLE are using this language, and they just are
now unable to understand ALL the implications of what they are
doing when they write any serious program.
The consequences are that C++ software is "brittle", in the sense that
a small change somewhere, that everybody thought it would be harmless
produces a whole series of catastrophes in other, unrelated parts
of the software.
It is not time to reflect about this problem?
jacob navia said:The problem with my brain is that its memory is not extensible. Trying
to understand and memorize the specifications for overloaded function
calls in the C++ specs goes for PAGES AND PAGES, impossible for a brain
to swallow and digest that without a severe indigestion.
The consequences are that C++ software is "brittle", in the sense that
a small change somewhere, that everybody thought it would be harmless
produces a whole series of catastrophes in other, unrelated parts
of the software.
C isn't all that much better in this regard. C parsers may be significantly
simpler to create than full-fledged C++ parsers, but that doesn't necessarily
mean that *programming* in C is any simpler or easier than in C++.
When developing large projects in C you usually need to use paradigms and
coding conventions that exist solely because of what C lacks (iow. they are
unnecessary in C++ and most other languages). In other words, you are
mostly just changing your brain capacity usage from learning language
features to learning coding conventions and strict guidelines that should
be unnecessary. In a way, you could say that most large projects use a
"megalanguage" on top of C, and any person who wants to participate in the
development of that project needs to learn it.
There arrives a point (that C++ has already passed beyond) where
there is no brain in the world, not even the one of Stroustrup,
that is able to understand 100% of the language.
See the "concepts"
debacle.
This means that in practice NO ONE understands the language he/she is
using in full. The language has become something beyond the capabilities
of mere people and only a compiler can understand it.
I have seen more and more posts where somebody asks here:
"Why doesn't this compile"?
And the answers are:
o Compiles in MSVC
o Doesn't compile in gcc
o Comeau accepts it...
without ANYBODY even trying to argue about WHY the construct
in question is right or wrong.
Nobody knows any more.
Everybody knows what I am speaking about yet this doesn't seem to be
seen as a problem and the committee keeps adding and adding features
(lambdas, etc) without any person trying to stop that trend, as if
"progress" in software construction implies always MORE complexity
and MORE complexity without any limit.
Precisely. Compared to C, C++ moves complexity /from/ N program to 1
language, so I don't have to learn N different partial solutions to
the same problem.
Le 30/06/11 08:10, Jorgen Grahn a écrit :
Yes, you have a point here (You and Mr Nieminen). That is a weak point
in C. I am trying to address this within the C community, with
relatively lack of success.
In this sense, the problems with those features is not that they exist,
but that their usage is extremely complicated and hard to follow.
Templates are an example of that. They are both great when they work,
incomprehensible when they don't. You have then, to memorize a series
of "gotchas" and template conventions that make the subject
extremely obscure and memory consuming.
Metaprogramming should be done at compile time within a specific
meta-language, designed to do that. This has been done with extremely
hard to follow templates like IF and others, that approach the
metalanguage goal without EXPLICITELY having a meta-language.
All the memory required to memorize the hacks needed now would be
unnecessary if we would have a simple functional language where
we describe templates with parameter checking, etc etc.
jacob navia said:All the memory required to memorize the hacks needed now would be
unnecessary if we would have a simple functional language where
we describe templates with parameter checking, etc etc. A meta-language
would (again) "move complexity /from/ N programs to 1 language"
On 06/30/11 06:42 PM, jacob navia wrote: ....
Not really, no. Most programmers get most of their exposure to
templates through the standard library and they don't find it obscure.
Jorgen Grahn said:I think though that to use C++ effectively you need to be able to
write new template code; it's not one of those features you can
happily ignore. They aren't just for people designing libraries, and
you don't have to be into template metaprogramming to use them.
Le 29/06/11 22:20, Juha Nieminen a écrit :
Sure, but I was speaking about HUMAN memory, who cares about computer
memory when you can buy megabytes for a dime a dozen?
The problem with my brain is that its memory is not extensible.
If you want that kind of flexibility and expressive power, you could
move to lisp or haskell. However, in practice the C-family of OO languages
(including C++, Java and C#) have the best support in most systems, so
you are pretty much stuck. (Also, the highly functional language require
a rather different mindset than imperative OO languages, which makes the
learning curve rather steep.)
Jorgen said:I don't find templates that hard to grasp; I think of them as
macros without the nasty surprises.
Juha said:The vast majority of templated code required in practical projects is
quite simplistic. Basically as "better macros" (ie. more type-safe,
etc). It's much rarer to need the *actual* metaprogramming
capabilities of C++ templates (such as overloading, specialization,
recursive template definitions, tricks related to conditional
template instantiation, SFINAE tricks, etc.)
In other words, in practical programs it's rare to need the more
complex aspects of templates.
Memory footprint. C++ uses up a LOT of memory.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.