Tuesday, June 26, 2018

Digest for comp.lang.c++@googlegroups.com - 13 updates in 5 topics

Sky89 <Sky89@sky68.com>: Jun 26 03:56PM -0400

Hello...
 
 
About C++..
 
I said before that type-safety of C++ is not good by default:
 
Here is my proof: look at this library that is "trying"(But it is
not yet sufficient) to improve the type-safety of C++:
 
Improve Type Safety in Your C++ Program With the type_safe Library
 
"Features provided by the type_safe library include improved built-in
types (ts::integer, ts::floating_point, and ts::boolean) which prevent
dangerous implicit operations like signed-to-unsigned promotion."
 
Read more here:
 
https://embeddedartistry.com/blog/2018/5/24/improve-type-safety-in-your-c-program-with-the-typesafe-library
 
 
This is why i said before the following:
 
Also I will not waste my time with C++, because from the start C++ was
handicaped, because it has inherited the deficiencies of C, i think C is
"not" a good programming language because it is "too" weakly typed and
it allows implicit type conversions that are bad for reliability etc.
and this looks like the mess of assembler, because C was "too" low level
for reliability, and since C++ has inherited from C, C++ has inherited
this too low level parts that are not good for reliability, so i will
not waste my time with C++ or with C, and i will continu to code in
"modern" Object Pascal of Delphi and FreePascal that is more
conservative because it has a "decent" reliability and a "decent"
performance, and those Delphi and FreePascal compilers are "powerful"
today. And i will also work with "Java", because Mono is not following
fast the developement of C# and it is not as portable as Java.
 
And here is what i wrote about C++ and Delphi and FreePascal and ADA:
 
Energy efficiency isn't just a hardware problem. Your programming
language choices can have serious effects on the efficiency of your
energy consumption. We dive deep into what makes a programming language
energy efficient.
 
As the researchers discovered, the CPU-based energy consumption always
represents the majority of the energy consumed.
 
What Pereira et. al. found wasn't entirely surprising: speed does not
always equate energy efficiency. Compiled languages like C, C++, Rust,
and Ada ranked as some of the most energy efficient languages out there.
 
Read more here:
 
https://jaxenter.com/energy-efficient-programming-languages-137264.html
 
RAM is still expensive and slow, relative to CPUs
 
And "memory" usage efficiency is important for mobile devices.
 
So Delphi and FreePascal compilers are also still "useful" for mobile
devices, because Delphi and FreePascal are good if you are considering
time and memory or energy and memory, and the following pascal benchmark
was done with FreePascal, and the benchmark shows that C, Go and Pascal
do rather better if you're considering languages based on time and
memory or energy and memory.
 
Read again here to notice it:
 
https://jaxenter.com/energy-efficient-programming-languages-137264.html
 
 
Also Delphi is still better for many things, and you have to get more
"technical" to understand it, this is why you have to look at this
following video about Delphi that is more technical:
 
Why are C# Developers choosing Delphi to create Mobile applications
 
https://www.youtube.com/watch?v=m8ToSr4zOVQ
 
 
And I think there is still a "big" problem with C++ and C..
 
Look at C++ explicit conversion functions, they were introduced in
C++11, but this doesn't come by "default" in C++, like in modern Object
Pascal of Delphi and FreePascal and like in ADA , because in C++ you
have to write explicit conversion functions etc., so this is not good
for reliability in C++, and C++ doesn't by "default" come with range
checking and Run-time checks that catch conversion from negative signed
to unsigned and arithmetic overflow , you have for example to add and
use SafeInt library for that, and C++ doesn't by "default" catch
out-of-bounds indices of dynamic and static arrays this is why C++ is
not good for reliability.
 
But Delphi and FreePascal like ADA come with range checking and Run-time
checks that catch conversion from negative signed to unsigned , and
catch out-of-bounds indices of dynamic and static arrays and catch
arithmetic overflow etc. and you can also dynamically catch this
exception of ERangeError etc. and they do not allow those bad
implicit type conversions of C++ that are not good for reliability.
 
And you can carefully read the following, it is very important:
 
https://critical.eschertech.com/2010/07/07/run-time-checks-are-they-worth-it/
 
 
And about Escher C++ Verifier, read carefully:
 
"Escher C Verifier enables the development of formally-verifiable
software in a subset of C (based on MISRA-C 2012)."
 
Read here:
 
http://www.eschertech.com/products/index.php
 
 
So it verifies just a "subset" of C, so that's not good for C++
because for other applications that are not a subset of C , it can
not do for example Run-time checks, so we are again into
this problem again that C++ and C don't have range checking and many
Run-time checks, so that's not good in C++ and C because it is not good
for reliability and it is not good for safety-critical systems.
 
 
So for all the reasons above , i think i will stop coding in C++ and
i will quit C++.
 
 
 
Thank you,
Amine Moulay Ramdane.
"Öö Tiib" <ootiib@hot.ee>: Jun 26 09:12AM -0700

On Sunday, 24 June 2018 08:39:37 UTC+3, Alf P. Steinbach wrote:
> I can't recall having seen this approach, so posting it here:
 
I did not understand what approach you had in mind?
Was it usage of temporary r-value with life-time of whole app run?
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jun 26 09:55PM +0200

On 26.06.2018 18:12, Öö Tiib wrote:
>> I can't recall having seen this approach, so posting it here:
 
> I did not understand what approach you had in mind?
> Was it usage of temporary r-value with life-time of whole app run?
 
Yes, I find it difficult to express cleanly as more C style code. The
original code had call to app::run() in two places. Not DRY.
 
Cheers!,
 
- Alf
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 26 08:20PM +0100

Hi!
 
My name is Rick C. Hodgin and not only do I spam Usenet groups with my
crazy spiritual beliefs but I also send spam e-mails directly to people
who don't agree with my Usenet spam because I am fucked up in the head.
 
--
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 26 10:06AM -0400

On 6/23/2018 12:20 PM, Rick C. Hodgin wrote:
> Please ignore the fake Rick C. Hodgin poster that claims Christianity is not
> a religion as his motives are manipulated by Satan.
 
> Christianity is a religion.
 
I, the real Rick C. Hodgin, did not write this post above. Please
examine the headers. I post only from Eternal September or Google
News, and from Indianapolis, IN.
 
The imposter here posted from an "en-GB" timezone using Giganews.
 
--
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 26 07:25AM -0700


> ...
 
> -----[ End ]-----
 
> If your God is not like the true Jesus Christ from the Bible ... get a new one.
 
Have you no answer, Kenny?
 
Specifically, which parts of my teaching do you think misalign with
what you believe to be "true teachings of Christianity?" Do you have
something specific? Or just a general feeling in your gut that what
I teach is wrong because you disagree with it?
 
You make an accusation for everyone to see, disparaging my good name
and the teachings I invest much into, those I offer to people in good
faith, and you do so all in one breath.
 
Let's see your real claims and examine them point-by-point against
scripture and see which one of us is the one with an unfounded claim.
 
If I am in error I will receive a rebuke, offer apologies, and begin
teaching the correct doctrine from that point forward. I will carry
a signature for six months indicating I was in error and that Kenny
McCormack corrected me.
 
But, if I am correct, then you have a whole new slew of worries to
ponder in your life, as do the multitude of others who read these
posts ... namely that there is a true calling upon your soul to repent
of sin lest you enter into Hellfire upon your death.
 
I assure you that I am correct, and that you do have those worries.
But I am willing to listen to your claims, Kenny.
 
Do you have an answer? Or will silence dictate the true fact that
you have only unfounded claims of falseness, of solely hollow, empty
accusations?
 
Let's see which way the truth falls here, Kenny. Will you answer
with something other than a mocking tagline of hate and accusations
of mere vapor?
 
--
Rick C. Hodgin
"Öö Tiib" <ootiib@hot.ee>: Jun 26 09:34AM -0700

On Monday, 25 June 2018 17:52:39 UTC+3, Rick C. Hodgin wrote:
 
> > And what Rick preaches is the later, not the former (regardless of what
> > terminology he uses).
 
> Hey Kenny, which part of my teaching do you think doesn't align with Christianity?
 
Most Christians do not behave (and so teach by example to be) major
assholes, trolls and criminals. Some Mormons and Jehovah Witnesses I have
seen sometimes to behave annoyingly but those have been humble
compared to you, Rick. History however has shown lot of Christians even
worse than you. There have been numerous crusaders, inquisitors,
torturers and witch hunters. Jesus did certainly by no story about him
to suggest anyone to be a jerk nor to use his name as excuse to brute
others ... but you already know it better than me.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 26 12:48PM -0400

On 6/26/2018 12:34 PM, Öö Tiib wrote:
> torturers and witch hunters. Jesus did certainly by no story about him
> to suggest anyone to be a jerk nor to use his name as excuse to brute
> others ... but you already know it better than me.
 
 
I teach the truth, Öö Tiib. You reject it now, but on the day of your
death you will then know the severity to which it was real, and needed
to be told to all people world-wide.
 
My eyes are on saving people's eternal souls from judgment by God and
damnation for those who do not know Jesus Christ as Savior and Lord.
 
You may laugh and joke and lump me into categories of those people
who have not served the Lord rightly from history, but I am not those
people, and my message is true.
 
You can go to scripture and see for yourself. In fact, I urge you to
go there and try and prove my advice and guidance wrong. Find out
any place where I am not doing what I should in teaching people the
truth with urgency.
 
--
Rick C. Hodgin
"Öö Tiib" <ootiib@hot.ee>: Jun 26 11:41AM -0700

On Tuesday, 26 June 2018 19:48:58 UTC+3, Rick C. Hodgin wrote:
 
> I teach the truth, Öö Tiib. You reject it now, but on the day of your
> death you will then know the severity to which it was real, and needed
> to be told to all people world-wide.
 
I have read that truth and Jesus has nowhere said that your "teaching"
or my disbelief of it are good excuses to be an asshole. I think Bible
is fully accessible to anyone interested and it is easier to reach than
food or water to many of us.
 
> My eyes are on saving people's eternal souls from judgment by God and
> damnation for those who do not know Jesus Christ as Savior and Lord.
 
Nor is wherever your "eyes are on" a good excuse to be a jerk.
 
> You may laugh and joke and lump me into categories of those people
> who have not served the Lord rightly from history, but I am not those
> people, and my message is true.
 
I did not laugh nor joke. I told actually what I believe is true, that
you are self-righteous asshole. That is not meant as insult but
statement of fact like I see it. I did not lump you with those bad
people but explicitly stated that there have been lot of far worse
"Christians" than you.
 
> go there and try and prove my advice and guidance wrong. Find out
> any place where I am not doing what I should in teaching people the
> truth with urgency.
 
I have read the scripture and I have found it actually to be interesting
book. You are most similar to members of sects of Pharisees an Sadducees
in that book. Pharisees believed in resurrection, angels and spirit like
you. Sadducees interpreted Torah literally like you. Members of both
of these sects were generally behaving as self-righteous jerks like you
or even worse. The third major Jewish sect of that time, Essenes, has
been never mentioned in Bible.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 26 02:55PM -0400

On 6/26/2018 2:41 PM, Öö Tiib wrote:
> or my disbelief of it are good excuses to be an .. . I think Bible
> is fully accessible to anyone interested and it is easier to reach than
> food or water to many of us.
 
I have not been as you claim. I have been instructing you in the
very thing you need more than food, water, or air, because you may
not be alive in the next 10 seconds. But your soul will be accountable
for your sin the moment you leave this Earth ... unless you have asked
Jesus to forgive you.
 
That is not being anything negative. That is telling you in a teaching
way the very thing you need to know right now, today, this second.
 
>> truth with urgency.
 
> I have read the scripture and I have found it actually to be interesting
> book.
 
If that is all you have found in reading it you need to read it
again because you have missed it.
 
I dare you to read the New Testament and find any place where my
teaching that you need to repent of sin in order to have eternal
life, and that Jesus is our only way to salvation, and that Jesus
told us to go forth and teach everybody this information, is any-
thing other than our true calling.
 
It is the most essential piece of knowledge we can come to, Öö Tiib.
It is absolutely essential ... more so than food, water, or even air.
And that is not an exaggeration. That is total truth.
 
--
Rick C. Hodgin
boltar@cylonHQ.com: Jun 26 09:51AM

On Mon, 25 Jun 2018 19:37:59 +0300
>list' to 'int *'").
 
>The fact that the two usage cases look the same but are not are due to
>the problems with the old C syntax.
 
You still haven't answered the question as to why my original idea would
be difficult to implement. I can't see any reason why it couldn't be done.
 
>}
 
>(you need to add consts because C++ is trying to keep you from
>accidentally modifying the temporary).
 
That might be what you have to do now, I'm asking why they DIDN'T implement
a much simpler syntax given its already used for lvalue initialisation.
Paavo Helde <myfirstname@osa.pri.ee>: Jun 26 03:01PM +0300


>> int* i = { 1,2,3 };
 
> That might be what you have to do now, I'm asking why they DIDN'T implement
> a much simpler syntax given its already used for lvalue initialisation.
 
As I said, that lvalue was an array, not a pointer. If you write
 
void func(int x[])
 
then x is a pointer, which is something entirely different than an array.
 
So maybe your proposal is to add a special conversion rule: whenever
there is a need to convert an initializer list into a pointer, make a
hidden temporary array instead, initialize it via the initializer list
and assign the pointer to the address of the first element.
 
Alas, this proposal does not work with the idea that single scalars like
pointers can be also initialized via brace syntax (for "uniform"
initialization and avoiding "most vexing parse" fiasco):
 
int x = {2};
int y = {}; // initialized to 0
int** z = {nullptr}; // z initialized to NULL by current rules.
 
The new proposal would make the last z to point to the 1-element array
instead, which would change the existing behavior and the simple scalar
initialization rule. Moreover, the temporary array would be destroyed at
the semicolon, so the pointer would become dangling.
 
The same holds for function calls:
 
void foo(int** p);
foo({nullptr}); // currently passes p=NULL.
 
 
A bit saner rule would be to add special rules for [] syntax in function
parameters. Currently void foo(int* x) and void foo(int x[]) are the
same, but in principle they could mean different things.
 
#include<iostream>
void func1(int** b1) {std::cout << b1 << "\n";}
void func2(int* b2[]) {std::cout << b2 << "\n";}
 
int main() {
int** a1 = {nullptr};
int* a2[] = {nullptr};
std::cout << a1 << "\n" << a2 << "\n";
func1({nullptr});
func2({nullptr});
}
 
Currently this prints:
0000000000000000
000000000029F8A0
0000000000000000
0000000000000000
 
because func1 and func2 are identical. The new rule would make them
different so that the last line would also print non-zero.
 
I guess such a change could be done hypothetically, but it would
effectively change the old C rule of array decay into a pointer. I guess
all C++ specialists are so familiar with that rule that it has never
occurred to them to change it, and probably they are right, changing
something so low-level probably has bad consequences.
Manfred <noname@invalid.add>: Jun 26 02:49PM +0200

On 6/26/2018 2:01 PM, Paavo Helde wrote:
 
> As I said, that lvalue was an array, not a pointer. If you write
 
> void func(int x[])
 
> then x is a pointer, which is something entirely different than an array.
 
[...]
 
 
> I guess such a change could be done hypothetically, but it would
> effectively change the old C rule of array decay into a pointer.
The fact is that the C rule is old, but still very valid. This means
that it is a legacy that is practically required to stick to.
On top of that, meanwhile this has become C++ legacy too, and breaking
changes are notoriously on top of the "no go" list.
 
I guess
> all C++ specialists are so familiar with that rule that it has never
> occurred to them to change it, and probably they are right, changing
> something so low-level probably has bad consequences.
 
I don't think it has never occurred, in fact even amongst C specialists
the array to pointer decay rules have been long and frequently discussed
and objected, but still the need not to break existing code is the
strongest force - which by the way I can understand.
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: