Thursday, March 8, 2018

Digest for comp.lang.c++@googlegroups.com - 25 updates in 6 topics

"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 05:05PM -0800

On 3/7/2018 10:35 AM, Lynn McGuire wrote:
> this might fit the bill.
 
> Hat tip to:
 
> http://www.osnews.com/story/30220/Clang_is_now_used_to_build_Chrome_for_Windows
 
Interesting. Thank you for the post.
Christian Gollwitzer <auriocus@gmx.de>: Mar 08 08:36AM +0100

Am 07.03.18 um 19:35 schrieb Lynn McGuire:
 
> Hey, neat !  I need to check Clang on their Fortran 77 compiler status.
> I want to slowly transition our F77 code to C++ in Visual Studio and
> this might fit the bill.
 
I don't think you need clang for that, gcc (gfortran or g77) should do
it. For a C <-> Fortran bridge you only need compatibility for C ABI
functions, and there gcc is compatible with VC++ for long time. Only in
case of C++, i.e. name mangling, exceptions etc., you would need clang.
 
Another option for pure F77 code is f2c which translates F77 into C, and
then you can trivially compile and link it with C++ code. Apart from
strange calling conventions (every parameter, even an integer, is passed
by pointer) this works fairly well. I'm using this in a project to call
out to LAPACK functions.
 
Christian
Lynn McGuire <lynnmcguire5@gmail.com>: Mar 08 04:04PM -0600

On 3/8/2018 1:36 AM, Christian Gollwitzer wrote:
> by pointer) this works fairly well. I'm using this in a project to call
> out to LAPACK functions.
 
>     Christian
 
My calculation engine is about 800K lines of F77+ code with about 10,000
lines of C++ code. I need the Visual Studio C++ compiler on Windows to
get rid of a nasty little bug that we have in some system sensitive code.
 
I would not use f2c to convert F77 code to C. You get horribly mangled
code. The Fable F77 to C++ code looks much cleaner. Fable does have a
weirdism in that it converts all common block variables to a single huge
global variable and passes that around through the argument list. With
my 300+ common blocks, that might be difficult to debug.
http://cci.lbl.gov/fable/
 
Lynn
 
Thanks,
Lynn
Tim Prince <tprince@intelretiree.com>: Mar 08 05:48PM -0500

On 3/8/2018 5:04 PM, Lynn McGuire wrote:
 
> Lynn
 
> Thanks,
> Lynn
 
If their reference Fortran code is as unmaintainable as they say, it's
difficult to believe that automatic translation can fix that. We don't
have much Fortran left which fits their restriction to fixed form F77,
although I have kept my tools around which translate limited f90 back to
f66. Still, it might be good occasionally to have an alternative to
f2c. I guess they have to drop their past goal of putting a great deal
of effort to translate so as to support systems with minimal tools, now
that they need python and c++, and you won't find them on a system which
lacks gfortran.
 
--
Tim Prince
Ian Collins <ian-news@hotmail.com>: Mar 08 05:27PM +1300

On 03/08/2018 09:01 AM, Gareth Owen wrote:
> more anonymous function calls to public_func1() and their inlined
> equivalents to public_func2(). More than enough to get me fired.
 
> Never the less, their test suites are identical.
 
That's were we disagree.
 
If with the more modular solution, the code extracted to helper
functions can be tested independently of the parent function, so we:
 
a) don't have to test its behaviour when we test the parent.
b) can mock them to make testing the parent easier.
 
--
Ian.
asetofsymbols@gmail.com: Mar 08 12:33AM -0800

Thank you for C++ and C
 
They scale well to assembly
and a convenient subset can be easy to program and debug too
 
But your questions on goto show some ignorance of what is readability
on what is easy and in what is difficult
Vir Campestris <vir.campestris@invalid.invalid>: Mar 08 09:27PM

On 08/03/2018 04:27, Ian Collins wrote:
 
> functions can be tested independently of the parent function, so we:
 
> a) don't have to test its behaviour when we test the parent.
> b) can mock them to make testing the parent easier.
 
Overuse of little worker functions can make understanding code harder.
But then, so can the 10000 line function. There's a happy medium.
 
I never wrote a goto in <mumble> years of coding until I met Linux. It's
a kernel standard to use goto where C++ should use throw.
 
Andy
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 08 06:47AM -0800

I've always looked at C++ as being overtly complex, obtuse in much
of its syntax, having some ideals and goals which seemed outside of
what I would consider to be a "proper norm" for data processing.
 
In developing CAlive, and in going through all of its rigors and
internal requirements of design, I am seeing that much of what I
previously thought of regarding C++'s "poor design and/or imple-
mentation" was really just my not understanding why things worked
the way they do in C++.
 
As such, I have a new appreciation and respect for C++. I no
longer hold it in such negative regard. However, there are still
many aspects about its design choices that I disagree with, and
CAlive development will continue (James 4:15 Lord willing).
 
--
Rick C. Hodgin
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 08 12:12PM -0800

On 3/8/2018 6:47 AM, Rick C. Hodgin wrote:
> I've always looked at C++ as being overtly complex, obtuse in much
> of its syntax, having some ideals and goals which seemed outside of
> what I would consider to be a "proper norm" for data processing.
 
However, you compile your C with a C++ compiler.
 
> previously thought of regarding C++'s "poor design and/or imple-
> mentation" was really just my not understanding why things worked
> the way they do in C++.
 
Nice! :^D
 
> longer hold it in such negative regard. However, there are still
> many aspects about its design choices that I disagree with, and
> CAlive development will continue (James 4:15 Lord willing).
 
Fair enough.
Ralf Goertz <me@myprovider.invalid>: Mar 08 10:03AM +0100

Hi,
 
I wondered why there is no std::accumulate function or at least
something that allows me to do that easily using <algorithm> (or is
there?). Of course I can just iterate myself but that's not the point.
So I tried to write a templated class inheriting from
iterator<output_iterator_tag, T> and defined all increment and decrement
operators to do nothing. (It turned out I only needed one of them so I
left out the others in the code below.) Within the iterator class I
defined a helper class that allows me to change "=" to be "+=". Then I
use std::copy() to do the job. It seems to work principle as the outout
shows but all those copies flying around I end up with nothing. Which I
don't understand since I defined all copy and assignment constructors
for both the iterator class and it's helper class to always copy my
value around. So what is the problem?
 
#include <algorithm>
#include <iterator>
#include <vector>
#include <iostream>
 
using namespace std;
 
template<typename T> struct Accum:public iterator<output_iterator_tag, T> {
struct Val {
T s;
explicit Val(const T & s_) :s(s_){
cerr<<this<<" Val(cons T&) right: "<<s_<<endl;
}
explicit Val(const Val& v) : s(v.s) {
cerr<<this<<" Val(const Val&) right: "<<&v<<endl;
}
Val & operator=(const Val& v) {
s=v.s;cerr<<this<<" Val operator=(const Val&) right: "<<&v<<endl;
}
Val & operator=(const T& t) {
s+=t;
cerr<<this<<" Val & operator=(const T&) "<<t<<" result "<<s<<endl;
return *this;
}
operator T() const {cerr<<this<<" operator T(): "<<s<<endl;return s;}
} n;
Accum():n(0) {
cerr<<this<<" Accum() "<<n<<endl;
}
Accum(const Accum &r) : n(r.n) {
cerr<<this<<" Accum(const Accum&) right: "<<&r.n<<endl;
}
Accum& operator=(const Accum &r) { //doesn't get called
n=r.n;
cerr<<this<<" operator=(const Accum&) right: "<<&r.n<<" result"
<<n.s<<endl;
}
Accum& operator++() {
cerr<<"++ called"<<endl;
return *this;
}
Val & operator*() {
cerr<<this<<" * called n="<<n.s<<endl;
return n;
}
};
 
 
int main() {
vector<int> v{{6,2,3}};
Accum<int> a;
copy(v.begin(),v.end(),a);
cout<<*a<<endl;
return 0;
}
 
output:
 
0x7ffd3d549320 Val(cons T&) right: 0
0x7ffd3d549320 operator T(): 0
0x7ffd3d549320 Accum() 0
0x7ffd3d549330 Val(const Val&) right: 0x7ffd3d549320
0x7ffd3d549330 Accum(const Accum&) right: 0x7ffd3d549320
0x7ffd3d549350 Val(const Val&) right: 0x7ffd3d549330
0x7ffd3d549350 Accum(const Accum&) right: 0x7ffd3d549330
0x7ffd3d549370 Val(const Val&) right: 0x7ffd3d549350
0x7ffd3d549370 Accum(const Accum&) right: 0x7ffd3d549350
0x7ffd3d549380 Val(const Val&) right: 0x7ffd3d549370
0x7ffd3d549380 Accum(const Accum&) right: 0x7ffd3d549370
0x7ffd3d549360 Val(const Val&) right: 0x7ffd3d549380
0x7ffd3d549360 Accum(const Accum&) right: 0x7ffd3d549380
0x7ffd3d549360 * called n=0
0x7ffd3d549360 Val & operator=(const T&) 6 result 6
++ called
0x7ffd3d549360 * called n=6
0x7ffd3d549360 Val & operator=(const T&) 2 result 8
++ called
0x7ffd3d549360 * called n=8
0x7ffd3d549360 Val & operator=(const T&) 3 result 11
++ called
0x7ffd3d549340 Val(const Val&) right: 0x7ffd3d549360
0x7ffd3d549340 Accum(const Accum&) right: 0x7ffd3d549360
0x7ffd3d549320 * called n=0
0x7ffd3d549320 operator T(): 0
0
"James R. Kuyper" <jameskuyper@verizon.net>: Mar 08 09:33AM -0500

On 03/08/2018 04:03 AM, Ralf Goertz wrote:
> Hi,
 
> I wondered why there is no std::accumulate function
 
There is: it's in <numeric> and defined in section 29.8.2 of the standard:
 
> acc with the initial value init and then modifies it with
> acc = acc +*i or acc = binary_op(acc, *i) for every iterator i in
> the range [first, last) in order. 282
~/testprog(115) cat accumulate.cpp
#include <iostream>
#include <numeric>
#include <vector>
 
int main(void) {
std::vector<int> v{{6,2,3}};
std::cout << std::accumulate(v.begin(), v.end(), 0L) << std::endl;
return 0;
}
~/testprog(116) g++ -std=c++1y -pedantic -Wall -Wpointer-arith
-Wcast-align -ffor-scope -fno-gnu-keywords -fno-nonansi-builtins
-Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast
-Woverloaded-virtual -Wsign-promo accumulate.cpp -o accumulate
~/testprog(117) ./accumulate
11
 
...
> vector<int> v{{6,2,3}};
> Accum<int> a;
> copy(v.begin(),v.end(),a);
 
The fundamental problem here is that a gets passed to std::copy<>() by
value. In other words, the third parameter of std::copy() is a separate
instance of Accum<int>, initialized with a copy of the values stored in
a. All that accumulation occurs inside the copies of that object which
std::copy<>() creates. The value of a itself remains completely unchanged.
 
> cout<<*a<<endl;
 
And therefore, it does not reflect the accumulation that has occurred.
In order to do what you want done, 'n' should exist outside of the
iterator. Initialize your iterator from a pointer or reference to that
object, and have copy/assignment of your iterator produce a new iterator
that points/refers to the same external object as the original. Then
your code should work (unless it has some other flaw I haven't noticed yet).
Ralf Goertz <me@myprovider.invalid>: Mar 08 04:19PM +0100

Am Thu, 8 Mar 2018 09:33:51 -0500
> that object which std::copy<>() creates. The value of a itself
> remains completely unchanged.
 
> > cout<<*a<<endl;
 
Of course, it's passed by value! How blind of me. I didn't think that I
would ever be caught in that beginner's trap again. Thanks for proving
me wrong. ;-) And thanks for pointing me to <numeric> of whose content I
have been ignorant up to now.
legalize+jeeves@mail.xmission.com (Richard): Mar 08 06:59PM

[Please do not mail me a copy of your followup]
 
Ralf Goertz <me@myprovider.invalid> spake the secret code
 
>[...] And thanks for pointing me to <numeric> of whose content I
>have been ignorant up to now.
 
A good way to discover stuff like this is to search cppreference.com :)
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 04:41PM -0800

> What utter nonsense. Most atheists (myself included) would love for there to be an afterlife but they choose to accept reality. It is you who refuses to accept reality pretending instead that there is a happy ending rather than the inevitable nothingness.
 
Well, if an atheist lives a good life, then they might get into some
sort of win-win scenario. If there is life after death, and you lived a
good life, then welcome! If there is no life after death, then you will
never be there to know anything at all: The absolute void.
 
Fair enough? ;^)
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 04:53PM -0800

On 3/7/2018 10:49 AM, Rick C. Hodgin wrote:
>> present evidence on your previous thread. That is so typical of your
>> kind, you can't sustain a debate, so you spout yet more baseless assertions.
 
> I don't debate. I teach.
 
Really? Remember the answer you gave me wrt my question about how many
chances does one get to be forgiven. First you told me to go bother
people at my local church. Then you gave this gem:
_____________________
The answer Chris seeks is not an answer that can be given without
first correcting the underlying error in understanding which led to
the question being asked in the first place. We're back to:
 
"When you spread peanut butter on bread, Rick, what do
you do with the shells? Do you recycle them?"
 
In order to seek the truth, the baseline understanding must be corrected
so the questioner himself/herself will see the error of the question
and withdraw it, as the understanding lends the true question, and
the true answer, without the need to even ask.
_____________________
 
Just wow.
 
You answer my question my suggesting that my question is erroneous.
 
LOL! What a pile of garbage. Wow!
 
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 04:57PM -0800

On 3/7/2018 11:11 AM, Rick C. Hodgin wrote:
> understanding, that you too might be saved. It's a different task than
> debating things relating to Christ as I might do with another Christian,
> and even then it isn't debating, it's full-on truth-seeking.
 
Question to Rick: (simple question about the Bible)
 
Answer from Rick: (the question is erroneous because satan told you to
ask it in the first place)
 
;^o
 
He should write a program that does this for him. Heck, it would
actually be on topic.
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 04:59PM -0800

On 3/7/2018 10:18 AM, Mr Flibble wrote:
>> not come to Christ until almost August, 2004, and most interviews were in
>> April-June.
 
> Ah that makes sense and explains everything.
 
Yes. This makes things a heck of a lot clearer now. Wow.
 
 
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 05:02PM -0800

On 3/7/2018 10:54 AM, Rick C. Hodgin wrote:
 
> It's ironic because I wrote this:
 
> You like to make jokes and summarize what you think is happening,
> rather than scrutinizing the details.
 
I asked you about some of the "details". The first answer I got was
comprised of you suggesting that I go bother my local church. Then you
suggested that the question itself is somehow wrong. Wtf?
 
Teacher? LOL!!!!
 
[...]
Christiano <christiano@engineer.com>: Mar 07 10:58PM -0300

On 03/07/2018 12:04, Rick C. Hodgin wrote:
> [...]
 
How to report Rick to Google
 
To: groups-abuse@google.com
Body:
Rick C. Hodgin is doing religious proselytism in the newsgroup
comp.lang.c++. His e-mail is rick.c.hodgin@gmail.com .
He's been bothering insistently for a long time. It is not about one or
two messages, it's a long-term hassle that simply needs a solution.
It is not about being against or favoring a particular religion, it is
simply that this is not a newsgroup about religion at all, so that when
he does so, he is intentionally being a vandal and needs to be punished
as such.
 
Headers:
X-Received: by 10.55.163.77 with SMTP id m74mr16742710qke.29.1520435088356;
Wed, 07 Mar 2018 07:04:48 -0800 (PST)
X-Received: by 10.31.178.81 with SMTP id b78mr2540387vkf.14.1520435088086;
Wed, 07 Mar 2018 07:04:48 -0800 (PST)
Path: not-for-mail
Newsgroups: comp.lang.c++
Date: Wed, 7 Mar 2018 07:04:47 -0800 (PST)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com;
posting-host=12.18.147.98; posting-account=BcpLkAoAAACbVwkzAAKP0XXOd-MDREpp
NNTP-Posting-Host: 12.18.147.98
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <42b2d42d-5f11-4e2c-9f93-e0dfd8578637@googlegroups.com>
Subject: Stand up for Christ
From: "Rick C. Hodgin" <rick.c.hodgin@gmail.com>
Injection-Date: Wed, 07 Mar 2018 15:04:48 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2552
X-Received-Body-CRC: 2959598731
 
A warning to all Christians:
 
To stand up for Christ in this world means you will be hated by
everyone who is not being saved. They will literally hate you.
They will want you harmed. They will want you killed, because
the things of Christ you hold to and testify about, they testify
against them.
 
As you shine the light of truth into the darkness, those walking
in darkness will seek to destroy that light in any way necessary.
They will attempt to make it go away, and when that doesn't work,
they'll run off to another dark place so they can continue on in
their sinful deeds without the constant reminder that there is a
Holy God who will judge all sin, including the sin in their life.
 
When you stand up for God in this world, when you profess the name of
Jesus Christ as the only way to have one's sins be forgiven ... prepare
to be attacked from every side.
 
It is the natural way of things because those who are perishing know
the truth, and they do not want the truth, but rather they want to walk
in falseness. They try to suppress the truth any way they can.
 
--
Rick C. Hodgin
 
PS -- To all walking in darkness today: There is no shame. Jesus
knows who you are, what you've done, why you did it, and He
loves you anyway. He will forgive you for your sin today,
right now. Just ask Him: "Jesus, I am a sinner. I have
sinned. Please forgive my sin and give me eternal life." If
you do that with sincerity, your entire life will change,
beginning even today.
Christiano <christiano@engineer.com>: Mar 07 11:03PM -0300

On 03/07/2018 22:58, Christiano wrote:
> On 03/07/2018 12:04, Rick C. Hodgin wrote:
>> [...]
 
How to report Rick to Eternal September
 
To: abuse@eternal-september.org
Body:
Rick C. Hodgin is doing religious proselytism in the newsgroup
comp.lang.c++. His e-mail is rick.c.hodgin@gmail.com .
He's been bothering insistently for a long time. It is not about one or
two messages, it's a long-term hassle that simply needs a solution.
It is not about being against or favoring a particular religion, it is
simply that this is not a newsgroup about religion at all, so that when
he does so, he is intentionally being a vandal and needs to be punished
as such.
 
Posting account="U2FsdGVkX1/5SCA5HDW5F23BtfdzZnD+zQ5uiRt6t9I="
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 07 06:26PM -0800

Christiano, Leigh, others,
 
https://www.biblegateway.com/passage/?search=Matthew+5%3A11-12&version=KJV
 
Matthew 5:11 -- Blessed are ye, when men shall
revile you, and persecute you, and shall say
all manner of evil against you falsely, for my
sake.
 
12 -- Rejoice, and be exceeding glad: for great
is your reward in heaven: for so persecuted
they the prophets which were before you.
 
https://www.biblegateway.com/passage/?search=Luke+6%3A22-23&version=KJV
 
Luke 6:22 -- Blessed are ye, when men shall
hate you, and when they shall separate you
from their company, and shall reproach you,
and cast out your name as evil, for the Son of
man's sake.
 
23 -- Rejoice ye in that day, and leap for joy: for,
behold, your reward is great in heaven: for in
the like manner did their fathers unto the prophets.
 
It means the message is getting through. The warning has
been received.
 
--
Rick C. Hodgin
Daniel <danielaparker@gmail.com>: Mar 07 07:29PM -0800

On Wednesday, March 7, 2018 at 10:05:03 AM UTC-5, Rick C. Hodgin wrote:
 
> everyone who is not being saved ... will want you killed, because
> the things of Christ
 
Nah, they just want you to stop spamming usenet, that's all.
 
Daniel
Daniel <danielaparker@gmail.com>: Mar 07 07:46PM -0800

On Wednesday, March 7, 2018 at 1:32:15 PM UTC-5, Rick C. Hodgin wrote:
 
> I am a sinner. I am guilty. I need forgiveness.
 
Okay, you spam usenet, which is a sin, and I understand from your other
posts that you can be a little annoying to your wife and fellowship circle
by overdoing the proselytizing, but in the scheme of things, I imagine your
sins are pretty minor and not all that interesting. I'm sure you don't
murder or cheat anybody. Any I'm sure you can make up for the trifling
sins by helping your elderly neighbors and your gay and lesbian brothers and
sisters when they need help.
 
Daniel
David Brown <david.brown@hesbynett.no>: Mar 08 08:43AM +0100

On 07/03/18 19:49, Rick C. Hodgin wrote:
>> present evidence on your previous thread. That is so typical of your
>> kind, you can't sustain a debate, so you spout yet more baseless assertions.
 
> I don't debate. I teach.
 
Nonsense. You don't debate - that much is true. You have no arguments,
no reasons, no justifications, no evidence. All you have is "the Bible
is true because the Bible says it is true". /Nothing/ else. Most
Christians - at least "born again" Christians - have realms of evidence
that they can give (circumstantial evidence, observations interpreted in
a particular way, highly personal things, etc., but more than enough to
make it clear why /they/ believe). You can't give any reasoning beyond
your tiny little pointless circular argument about the Bible.
 
And you certainly don't /teach/. You pontificate. /Teaching/ involves
give and take, listening to your "students", adapting the material to
suit, presenting it in a way that encourages learning. Regurgitating
quotations from an old book, posting links to madmen on youtube that no
one will ever look at, insulting people, threatening them with
damnation, and dodging questions by claiming they are the "wrong"
questions - that is not teaching.
 
Your key problem is that you think the most important feature of the
Christian message is that Christians will be hated - "love thy
neighbour" and everything else comes below that in your eyes. You then
make the incorrect extrapolation that the more hated you are, the more
"Christian" you are. Thus you try to do all you can to make people hate
you by trying to spread your cult.
 
Guess what? You are failing at that too. People in these newsgroups -
most people, at least - /don't/ hate you. A great many hate your
postings and your attitude, but not /you/. It turns out that "hate the
sin, not the sinner" is fundamental to being a good person, as most
people are, and has no connection whatsoever with any religious beliefs.
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 07 04:27PM -0800

On 3/7/2018 6:48 AM, Rick C. Hodgin wrote:
 
> The Bible is inspired of God, and contains the necessary knowledge God
> has given mankind to come to repentance and ask forgiveness for their sin.
 
> There have been five distinct ages of man:
[...]
 
I asked you a simple question, and got nothing.
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: