Thursday, September 12, 2019

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

woodbrian77@gmail.com: Sep 11 07:44PM -0700

On Wednesday, September 11, 2019 at 1:39:06 AM UTC-5, Öö Tiib wrote:
 
> TeamCity has likely best GitHub integration.
> Other popular choices are Bamboo, Hudson and Jenkins.
 
I want a hosted CI service. It seems like TeamCity,
Bamboo and Jenkins don't do that.
"Öö Tiib" <ootiib@hot.ee>: Sep 11 11:10PM -0700

> > Other popular choices are Bamboo, Hudson and Jenkins.
 
> I want a hosted CI service. It seems like TeamCity,
> Bamboo and Jenkins don't do that.
 
Why should anyone want to provide service that compiles your crap
and runs your unit tests on each commit for free?
woodbrian77@gmail.com: Sep 12 09:36AM -0700

On Thursday, September 12, 2019 at 1:10:32 AM UTC-5, Öö Tiib wrote:
> > Bamboo and Jenkins don't do that.
 
> Why should anyone want to provide service that compiles your crap
> and runs your unit tests on each commit for free?
 
It's not crap. It's increasingly robust and flexible
software with a business plan behind it. T. Boone
Pickens passed on yesterday. He used to say: A fool with
a plan can beat a genius with no plan.
 
I built my software yesterday on Linux 5 with Gcc 9.2 for
the first time. This combo produced the smallest versions
of my executables to date.
 
Services are often free in order to garner users. Often
though they are only free for the first 30 days or so. The
C++ Middleware Writer is free without limits like that.
 
 
Brian
Ebenezer Enterprises - "America isn't great because America
is powerful. America is powerful because America is great."
Ben Shapiro at dailywire.com
https://github.com/Ebenezer-group/onwards
scott@slp53.sl.home (Scott Lurndal): Sep 12 05:06PM


>I built my software yesterday on Linux 5 with Gcc 9.2 for=20
>the first time. This combo produced the smallest versions=20
>of my executables to date.
 
Executable size is a useless metric. Why do you think it is
either useful or interesting?
 
Run-time memory usage, now _that_ matters.
woodbrian77@gmail.com: Sep 12 10:53AM -0700

On Thursday, September 12, 2019 at 12:06:32 PM UTC-5, Scott Lurndal wrote:
> >of my executables to date.
 
> Executable size is a useless metric. Why do you think it is
> either useful or interesting?
 
https://duckduckgo.com/?q=mark+cppnow+vmware&t=h_&ia=videos&iax=videos&iai=vGV5u1nxqd8
 
I was already doing that before I watched that.
 
 
 
Brian
Szyk Cech <szykcech@spoko.pl>: Sep 12 08:22PM +0200

> Shalom
 
Здравствуйте товарищи!!!
 
Your project is interested some what to me. And I have question:
 
I read:
https://github.com/Ebenezer-group/onwards/blob/master/example/receiveExample.cc
and
 
To make that trick at receiver site:
 
::std::vector<int32_t> vec;
::std::string str;
give(buf,vec,str);
 
Am I suppose on sender site to use:
 
::std::vector<int32_t> vec {100,97,94,91,88,85};
marshal<messageID::id1>(buf,vec,"Proverbs 24:27");
 
before?
 
I ask to make sure that it is supposed to talk only with specific server.
My final question is:
Can't I receive and parse data from any binary protocol?
 
It will be nice to have generic binary format parser...
[ Additional string protocol will be nice. ]
Szyk Cech <szykcech@spoko.pl>: Sep 12 08:24PM +0200

On 12.09.2019 20:22, Szyk Cech wrote:
> [ Additional string protocol will be nice. ]
 
I mean: Additional generic string protocol parser will be nice.
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 11 07:50PM -0400

On 9/11/19 1:19 PM, Soviet_Mario wrote:
> I included C++ like headers, among them "plain" <string>
> and guess what ?
> the C++ header DONT have a strerror prototype.
 
The C++ header <string.h> has essentially the same contents as the C
header of the same name. The C++ header <cstring> differs from
<string.h> mainly in that the functions are declared inside the std::
namespace.
Keith Thompson <kst-u@mib.org>: Sep 11 05:11PM -0700

James Kuyper <jameskuyper@alumni.caltech.edu> writes:
[...]
> header of the same name. The C++ header <cstring> differs from
> <string.h> mainly in that the functions are declared inside the std::
> namespace.
 
<string.h> defines strerror and other identifiers in the global
namespace, and may optionally define them in the std namespace, while
<cstring> defines them in the std namespace and may optionally define
them in the global namespace.
 
(I dislike this, but that's the way the language specifies it.)
 
Also, the <*.h> C headers are deprecated as of C++17.
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 11 08:23PM -0400

On 9/11/19 8:11 PM, Keith Thompson wrote:
...
> Also, the <*.h> C headers are deprecated as of C++17.
 
I hadn't noticed that.
David Brown <david.brown@hesbynett.no>: Sep 12 11:21AM +0200

On 12/09/2019 02:23, James Kuyper wrote:
> ...
>> Also, the <*.h> C headers are deprecated as of C++17.
 
> I hadn't noticed that.
 
It is not going to make any practical difference, as any real-world C++
implementation also supports C, and has the C headers. I guess the aim
is to move C++ programmers to use the std:: namespace for standard C
functions as much as possible, reducing the global namespace usage.
 
I don't know how that works for macros defined in C standard headers -
they can't go into a namespace.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Sep 12 10:21AM

On Wed, 2019-09-11, Keith Thompson wrote:
 
>> What do you mean it's not thread-safe? AFAIK errno is thread-local
>> according to the standard.
 
> errno is thread-local.
 
And strerror doesn't use errno.
 
 
> The strerror function is not required to avoid data races with
> other calls to the strerror function. The implementation shall
> behave as if no library function calls the strerror function.
 
That was what I was referring to. Sorry for being unclear.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Soviet_Mario <SovietMario@CCCP.MIR>: Sep 12 01:05PM +0200

Il 12/09/19 12:21, Jorgen Grahn ha scritto:
>>> according to the standard.
 
>> errno is thread-local.
 
> And strerror doesn't use errno.
 
 
one can always pass errno to it ... but it does not strictly
guarantee that it will return the message associated with
THAT particular errno. Elsewhere some other caller could
have made another call and each receive mixed or the same
response depending on timing.
 
 
 
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Soviet_Mario <SovietMario@CCCP.MIR>: Sep 12 01:08PM +0200

Il 11/09/19 19:32, Paavo Helde ha scritto:
>> the C++ header DONT have a strerror prototype.
 
> That's expected. The C++ equivalent of <string.h> is
> <cstring>, not <string>.
 
ahhhh ! Got it. Strangely I had included the (useless)
<cerrno> but not completely consciously, and did not include
<cstring>
 
> And even with <cstring> you should
> call std::strerror(), not strerror().
 
it allowed plain strerror, maybe due to the fact I have
included a using namespace std directive. I will remove it
anyway
 
tnx again
 
 
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Thiago Adams <thiago.adams@gmail.com>: Sep 12 04:29AM -0700

On Thursday, September 12, 2019 at 8:08:46 AM UTC-3, Soviet_Mario wrote:
...
> ahhhh ! Got it. Strangely I had included the (useless)
> <cerrno> but not completely consciously, and did not include
 
C++ standard is creating differences from the same C header.
 
For instance:
C++ <cerrno> defines a lot of POSIX error codes.
"E2BIG, EACCES, ..., EXDEV"
https://en.cppreference.com/w/cpp/error/errno_macros
 
And C defines only EDOM, EILSEQ and ERANGE
https://en.cppreference.com/w/c/error/errno_macros
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 12 07:31AM -0400

On 9/12/19 5:21 AM, David Brown wrote:
 
>> I hadn't noticed that.
 
> It is not going to make any practical difference, as any real-world C++
> implementation also supports C, and has the C headers. ...
 
If they're deprecated now, it's a warning that they may be removed in
the future. If they are removed someday, that will give implementations
permission to no longer provide them, and sooner or later an
implementation will be created that doesn't. That date might be a long
time coming, but when it does, it will mark a major step in the
separation of C++ from C.
 
> functions as much as possible, reducing the global namespace usage.
 
> I don't know how that works for macros defined in C standard headers -
> they can't go into a namespace.
 
How it works is that they don't go in a namespace.
Manfred <noname@add.invalid>: Sep 12 03:44PM +0200

On 9/12/2019 1:31 PM, James Kuyper wrote:
 
>> I don't know how that works for macros defined in C standard headers -
>> they can't go into a namespace.
 
> How it works is that they don't go in a namespace.
 
Which is not really working, IMVVHO - I mean they compile and do the
job, but you end up with a mixture of std:: and non-std-qualified names
which I find ungood at best.
How bad it is varies from one implementation to one other, though.
Reinhardt Behm <rbehm@hushmail.com>: Sep 12 10:20AM +0800

On 9/12/19 1:04 AM, peteolcott wrote:
> to the entire set of positive reals.
 
> Notice that this entire set is countable using the set of positive
> integers.
 
If they are countable you can always list them in the counted order.
With my above example I can always construct numbers that are not in
your counted set. This disproves that you have counted them all. It
disproves that they are countable at all.
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 11 07:52PM -0700

On Wednesday, September 11, 2019 at 1:04:36 PM UTC-4, peteolcott wrote:
...
> I specified a whole Infinitesimal number system:
 
I see no such specification in this thread.
 
The term "whole infinitesimal number system" is made up of words that I
understand very well, but in combination, they don't mean anything to
me. They don't mean anything to Wikipedia or Google, either. The only
hit I got with either search engine was your use of that term in this
very discussion. Congratulations: you used a phrase that was a
googlenope until you used it.
 
> Real_Part[Infinitesimal_Part] where the Infinitesimal_Part is the number
> of geometric points offset from the real part.
 
That notation is unfamiliar to me as well, and that definition seems
meaningless as well. There's an infinite number of geometric points on
the number line between any two distinct real numbers. But I presume
that you could define an alternative mathematics where that isn't true,
and perhaps that notation is meant to be interpreted within the context
of some such alternative system?
 
> 0.0[1,∞] specifies the entire set of geometric points with a value
> greater than zero on the number line which self-evidently corresponds
> to the entire set of positive reals.
 
It's not particularly self-evident to me. That the set you're referring
to can be described in that fashion seems self-evidently to imply that
the set you're referring to is NOT the entire set of positive reals.
However, it's entirely possible that I've misunderstood something, so
I'll ask you a few questions about your notation.
 
1. Does 0.0[n] denote a real number for all positive integral values of
n?
2. What is the precise numerical value of 0.0[1]? Please use some more
conventional notation, such as a decimal expansion or an algebraic
expression to answer that question.
3. Just in case the answer to 2 is too esoteric for me to understand,
is it true that 0.0 < 0.0[1]?
Assuming that the answers to 1 and 3 are "yes", is there any
non-negative integral value of n such that 0.0[n] = (0.0 + 0.0[1])/2?
In particular, is true for either n=0 or n=1?
 
If 0.0[1] denotes a real number distinct from 0.0, then (0.0 + 0.0[1])/2
must denote another real number, distinct from both 0 and 0.0[1]. I
can't imagine how you could disagree with that statement, but I also
don't understand how you could make the claims you've made in that
message unless you did disagree with it. If you do disagree, please
explain.
 
> Notice that this entire set is countable using the set of positive integers.
 
Regardless of what your notation actually means, by construction the set
you describe is countable. My only objection is that it doesn't seem to
possess an important characteristic of the set of real numbers, one that is
shared by the set of rational numbers, which is countable: between any pair
of distinct points in the set, there's an infinite number of other distinct
points that are also in the set.
peteolcott <Here@Home>: Sep 11 11:51PM -0500

On 9/11/2019 9:20 PM, Reinhardt Behm wrote:
>> to the entire set of positive reals.
 
>> Notice that this entire set is countable using the set of positive integers.
 
> If they are countable you can always list them in the counted order. With my above example I can always construct numbers that are not in your counted set.
 
You can construct a number that is not on any point of the number line?
In other words you can construct a number THAT IS NOT A NUMBER.
That would be a (categorically impossible) neat trick.
 
 
 
--
Copyright 2019 Pete Olcott All rights reserved
 
"Great spirits have always encountered violent
opposition from mediocre minds." Albert Einstein
Keith Thompson <kst-u@mib.org>: Sep 12 01:22AM -0700

> On 9/12/19 1:04 AM, peteolcott wrote:
[...]
>> Notice that this entire set is countable using the set of positive
>> integers.
 
> If they are countable you can always list them in the counted order.
[...]
 
Reinhardt, let me urge you to take a look at comp.theory before
deciding whether it's worth your time to discuss anything with
Pete Olcott.
 
Either way, please drop comp.lang.c++ from the newsgroups list,
and consider whether the readers of comp.ai.philosophy want to read
about this.
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 12 04:20AM -0700

On Thursday, September 12, 2019 at 12:51:50 AM UTC-4, peteolcott wrote:
 
> >> Notice that this entire set is countable using the set of positive integers.
 
> > If they are countable you can always list them in the counted order. With my above example I can always construct numbers that are not in your counted set.
 
> You can construct a number that is not on any point of the number line?
 
No, he can construct a real number that is on the number line, but is not a member of your set, proving that your set does not contain all of the real numbers on the number line. He only refers to the countable property of your set, which suggests that he might be thinking of Cantor's diagonal argument, but your description of this set implies that the set is ordered: if n < m, then x[n] < x[m]. Is that correct? If so, then constructing such a number is much simpler. Such a set cannot even contain all of the rationals, which is a countable set.
 
If 0.0[1] is a positive real number distinct from 0.0, than (0.0 + 0.0[1])/2 is also a positive real number distinct from both 0.0 and 0.0[1]. If your set includes all positive real numbers, there must be a positive integral value of n such that 0.0[n] == (0.0 + 0.0[1])/2. What is that value?
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 11 11:01PM -0700

On 9/11/2019 11:16 AM, Szyk Cech wrote:
 
> [What I want]
> I want write reliable and modern Semaphore class.
> I want write unit test to validate it.
[...]
 
Here is a _very_ basic, bare bones semaphore:
__________________________
#include <iostream>
#include <mutex>
#include <condition_variable>
 
// Basic, bare bones C++ Semaphore
struct cpp_sem
{
unsigned int m_count;
std::mutex m_mutex;
std::condition_variable m_cond;
 
cpp_sem(unsigned int count = 0) : m_count(count)
{
 
}
 
void dec() // wait
{
std::unique_lock<std::mutex> lock(m_mutex);
while (m_count == 0) m_cond.wait(lock);
--m_count;
}
 
void inc() // post
{
{
std::unique_lock<std::mutex> lock(m_mutex);
++m_count;
}
 
m_cond.notify_one();
}
};
 
int main() {
 
std::cout << "p0\n";
 
{
cpp_sem sem(2);
sem.dec();
sem.dec();
 
std::cout << " a\n";
 
sem.inc();
sem.inc();
sem.inc();
 
std::cout << " b\n";
 
sem.dec();
sem.dec();
sem.dec();
sem.inc();
sem.dec();
 
std::cout << " c\n";
 
// sem.dec(); // uncomment for deadlock!
}
 
std::cout << "p1\n";
 
return 0;
}
__________________________
 
 
This can be improved upon.
Ralf Fassel <ralfixx@gmx.de>: Sep 12 11:14AM +0200

* Szyk Cech <szykcech@spoko.pl>
| void Semaphore::down()
| {
| unique_lock lock(mAccessMutex);
| --mCounter;
| if(mCounter < 0)
| mWaitingCondition.wait(lock);
| }
 
Look up "spurious wakeups". IMHO it is better to use the predicate-form
of cv.wait() (#2 in https://en.cppreference.com/w/cpp/thread/condition_variable/wait)
 
| for(unsigned long i(0); i < lArray.size(); ++i)
| lArray[i] = thread(SemTestThread, &lSem);
 
| bool lResult(true);
 
| for(int i(0); i < 5; ++i)
| lArray[i].join();
 
There is no guarantee that the first five threads will *not* block in
sem->down(). Just that they are created first does not guarantee they
execute first. If lArray[5] executes before lArray[4], lArray[4].join()
will block since it still waits in sem->down().
 
R'
"Öö Tiib" <ootiib@hot.ee>: Sep 12 01:05AM -0700

On Wednesday, 11 September 2019 17:28:31 UTC+3, JiiPee wrote:
> > c) or outputs its results to any other targets
 
> Thanks
 
> Can you give 1-2 examples pls?
 
It is tricky to give examples of all those architectural
patterns how to separate "presentation layer" of software from other
layers (like "service layer", "business logic layer", "persistence layer").
There are tons of materials to read about various takes on it like
"model-view-adapter", "presentation-action-control" or
"model-view-viewmodel".
 
> }
 
> should not be done like that in MyWindow class? because database is an
> outside source?
 
Yes.
 
 
> but it answer the question that mouse related code can be done in
> MyWindow, I understand. This is a real world example, because
 
> I process mouse input in my message handlers.
 
For rest of application there should be no such thing as
"mouse", "window" or "keyboard". Application should have
purpose.
 
>     }
> }
 
> so checking/processing the mouse values in MyWindow class function.
 
It is hard to explain since that MyWindow should have meaning,
the line where x is 150 should have meaning and clicking should
be meaningful gesture. Your examples lack any meaning whatsoever
so those can't be used for discussing what you want to discuss.
Better take something that has meaning, even if the meaning is
absurdly simple, for example how to separate tic-tac-toe game
and GUI for it.
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: