Wednesday, December 20, 2017

Digest for comp.lang.c++@googlegroups.com - 18 updates in 7 topics

Intelli2 <intelli2@mama.com>: Dec 20 05:29PM -0500

Hello,
 
 
I have worked with Delphi compiler and with FreePascal compiler, because
they are modern Object Pascal that is beautiful , because they are
excellent on readability and they are good on productivity, believe me
i have more experience now, but i have worked also with C++ and
it is excellent, it is why i am working with both , with modern Object
Pascal and with C++, why i am not working with Java and C# ? because
forcing garbage collection is also not good because it is also not
optimally efficient, i have posted on that before, please read again here:
 
https://people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
 
And i am now extending Delphi and FreePascal to support scalable
datastructures and more scalable compression libraries etc. but
what is good is that you can use my Delphi libraries from
C++Builder because C++Builder is compatible with Delphi.
 
 
 
Thank you,
Amine Moulay Ramdane.
Intelli2 <intelli2@mama.com>: Dec 20 05:13PM -0500

Hello,
 
 
I will post one time this kind of post here:
 
Here is a beautiful song, it is as beautiful as the Delphi compiler,
so, long life to Delphi and to FreePascal and to Lazarus and to also C++ !
 
 
https://www.youtube.com/watch?v=FCf23ZTFaDM
 
 
 
Thank you,
Amine Moulay Ramdane.
Intelli2 <intelli2@mama.com>: Dec 20 04:42PM -0500

Hello,
 
 
Read the following paper, because i have read it and it is interesting,
this is why i have posted here:
 
Quantifying the Performance of Garbage Collection vs. Explicit Memory
Management
 
"
Conclusion
 
This paper presents a tracing and simulation-based experimental
methodology that executes unaltered Java programs as if they used
explicit memory management. We use this framework to compare
the time-space performance of a range of garbage collectors to explicit
memory management with the Lea memory allocator. Comparing
runtime, space consumption, and virtual memory footprints
over a range of benchmarks, we show that the runtime performance
of the best-performing garbage collector is competitive with explicit
memory management when given enough memory. In particular,
when garbage collection has five times as much memory
as required, its runtime performance matches or slightly exceeds
that of explicit memory management. However, garbage collection's
performance degrades substantially when it must use smaller
heaps. With three times as much memory, it runs 17% slower on
average, and with twice as much memory, it runs 70% slower. Garbage
collection also is more susceptible to paging when physical
memory is scarce. In such conditions, all of the garbage collectors
we examine here suffer order-of-magnitude performance penalties
relative to explicit memory management.
 
We believe these results will be useful both for practitioners and
researchers. Practitioners can use these results to guide their choice
of explicitly-managed languages like C or C++, or garbage-collected
languages like Java or C#. If their applications will be deployed on
systems with at least three times as much RAM as needed, then
garbage collection should provide reasonable performance. However,
if the deployed systems will have less RAM, or if their applications
will have to compete with other processes for memory,
then practitioners should expect garbage collection to exact a
substantial performance cost. This cost will be especially pronounced
for applications whose performance is tied to their efficient use of
memory, such as in-memory databases and search engines.
"
 
 
 
Read more here:
 
https://people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
 
 
 
 
 
Thank you,
Amine Moulay Ramdane.
Thiago Adams <thiago.adams@gmail.com>: Dec 20 12:20PM -0800

On Tuesday, November 21, 2017 at 12:08:35 AM UTC-2, woodb...@gmail.com wrote:
...
 
> I think I may create a separate github repo for the modules
> version of my code. At first the non-modules repo would be
> the dominant repo. Is that how others are approaching it?
 
 
The approach I think is better to create a "module" is the amalgamation
like sqlite does.
You have a public interface with 1 header and 1 source code with
all the combined implementation.
To consume the library you just add these two files.
Thiago Adams <thiago.adams@gmail.com>: Dec 20 03:59AM -0800

On Tuesday, December 19, 2017 at 5:53:56 PM UTC-2, Richard wrote:
> I'm assuming it's expensive. My guess would be somewhere between $10K
> and $50K per seat. Still, that may be cheap compared to modernizing a
> legacy code base by hand (and presumably less error prone).
 
 
I am making a tool for C, that can read on source file build the
AST and generate the same code modified (or not) with all comments
macros etc.
https://github.com/thradams/CPrime
 
I trying to make my tool apply changes "in place" not in a new file
and this means that I have to edit the current file and not create
a new one. The difference is that I cannot create something already
created for instance. My next motivation is to to add C++ lambdas as
an extension for C. The lambda can be inside #ifdef and the some functions
are generated/edited to implement the lambda.
 
 
I am interested for these transformation strategies and also the Sutter's
Metaclasses.
 
Maybe some day, templates will be a subset of that can be done
with other declarative transformation language.
 
I was wondering if the C /C++ language had a standardized AST data structure
with basic operations. A program would be data structure. You can have
the same program as source file, or json, or xml or binary etc.
 
I think for modules they have to define some standard data structures
for declarations to create modules compatible between compilers.
Considering that modules have templates(Am I right?) then the modules
also need to have code representation.
 
I am thinking while I am writing..
so I am also wondering, Can I create a static analysis tool using the module
representation?
legalize+jeeves@mail.xmission.com (Richard): Dec 20 06:24PM

[Please do not mail me a copy of your followup]
 
>AST and generate the same code modified (or not) with all comments
>macros etc.
>https://github.com/thradams/CPrime
 
Seems like you're reinventing most of clang-tidy.
 
>I was wondering if the C /C++ language had a standardized AST data structure
>with basic operations.
 
Nope.
 
>I think for modules they have to define some standard data structures
>for declarations to create modules compatible between compilers.
 
Read the module proposal. This is explicitly not a design goal, IIRC.
--
"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>
Thiago Adams <thiago.adams@gmail.com>: Dec 20 11:35AM -0800

On Wednesday, December 20, 2017 at 4:25:14 PM UTC-2, Richard wrote:
...
> >I think for modules they have to define some standard data structures
> >for declarations to create modules compatible between compilers.
 
> Read the module proposal. This is explicitly not a design goal, IIRC.
 
I think they are delaying these questions.
Are modules of clang compatible with VC++ ?
Are modules compatible between compilers?
 
 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0142r0.pdf
 
 
"7 Tools Support
The abstract operational model of a module is that it contains everything that is
ever to be known about its constituents module units. In particular, we envision
that a high quality implementation will provide library interfaces for querying the
elaborated forms of declarations, hosting environmental values, including translation
command line switches, target machines, optional source form, binary form,
etc. Ideally, a module would provide all that is necessary for a code analysis tool.
A library interface to internal representation of modules will be the subject of
a separate proposal.
 
"
 
My understanding of modules is that they are big data structures that
represent exported code.
When you include the module you have something faster than parsing.
 
To archive this design the module cannot be affect by the external
pre-processor. In some ways it is similar of pre-compiled headers.
 
 
It's not clear for me if modules have the equivalent of static library
compiled code. In this case the exported code works like the includes
and the internal code as a library for one specific target.
ruben safir <ruben@mrbrklyn.com>: Dec 20 02:51PM -0500

> oes the statement still valid?
 
 
Ask Mr Tovalds.
ruben safir <ruben@mrbrklyn.com>: Dec 20 03:06PM -0500

On 12/18/2017 09:08 AM, Scott Lurndal wrote:
> with preprocessor macros.
 
ugg
ruben safir <ruben@mrbrklyn.com>: Dec 20 03:10PM -0500

On 12/19/2017 07:47 AM, Juha Nieminen wrote:
>> And how many operating systems need a sort function?
> Are going to ask that same question for every single simple example
> that could be given?
 
the scheduler has a whole red/black tree.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Dec 20 06:18AM

On Tue, 2017-12-19, Ralf Goertz wrote:
 
> You say that probably because for your native language there is no
> difference between ASCII and UTF-8. For those of us less fortunate (or,
> to put it differently, with a richer character set in their language)
 
For the record, this wasn't the reason I complained upthread[0].
 
It's more what David Brown described. When you have (typically)
monospaced fonts and multiple authors, it's troublesome to see a lot
of different ways to write the same thing (like quoting a piece of
text) and most of them will look almost -- but not quite -- identical
on the screen.
 
> it is a huge relief to have an encoding where you don't have to
> bother about code pages and stuff like that.
 
I think we compared ASCII and UTF-8 above. As I understand it,
iso8859-1 and friends aren't supposed to be used on USENET these days.
 
(The swedish groups used iso8859-1 as a convention, but they are
largely dead by now.)
 
> those other characters like „…" (ellipsis in german style quotation
> marks) just because I can and it is so much nicer. Spoiled by using
> LaTeX, I guess.
 
/Jorgen
 
[0] My own name needs non-ASCII, and the only reason I don't spell it
that way on USENET is that there would be a single character in a
typical posting of mine which would force it to UTF-9.
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Reinhardt Behm <rbehm@hushmail.com>: Dec 20 03:57PM +0800

AT Wednesday 20 December 2017 14:18, Jorgen Grahn wrote:
 
> iso8859-1 and friends aren't supposed to be used on USENET these days.
 
> (The swedish groups used iso8859-1 as a convention, but they are
> largely dead by now.)
 
Is iso8859-1 *that* unhealthy?
 
 
--
Reinhardt
Ralf Goertz <me@myprovider.invalid>: Dec 20 09:40AM +0100

Am Tue, 19 Dec 2017 20:02:17 +0000 (UTC)
> which there is no adequate representation in ASCII, there are also a
> bunch of Unicode characters for which the ASCII representation is just
> fine.
 
Interestingly enough, the quotation marks and the ellipsis survived your
quoting. Probably because trn doesn't declare an encoding in which case
I assume it's UTF-8. Might I ask why you don't use another news reader?
trn is a text application right? What about slrn or tin? I don't know
whether they support UTF-8 but they have relatively recent versions out
so I guess they do.
 
> We're not trying to typeset books on usenet or email, we're trying to
> communicate effectively. IMO, most of these kinds of uses of Unicode
> are impeding communication rather than enhancing it.
 
No, we are not typesetting a book. And I agree that the content of the
communication is more important than the form. But having UTF-8 around
is certainly a great advantage, especially in math news groups. Of
course I can write \emptyset but ∅ is so much nicer and easier to grasp.
It therefore helps communication.
 
 
> >With that I agree ;-)
 
> My statement was awkwardly worded, but you know I was saying your use
> of trailing return type was gratuitous, right? :)
 
You know that I am not Alf but Ralf, right? ;-)
legalize+jeeves@mail.xmission.com (Richard): Dec 20 06:28PM

[Please do not mail me a copy of your followup]
 
Ralf Goertz <me@myprovider.invalid> spake the secret code
 
>> My statement was awkwardly worded, but you know I was saying your use
>> of trailing return type was gratuitous, right? :)
 
>You know that I am not Alf but Ralf, right? ;-)
 
It's just that when I reread that as quoted, I realized that Alf might
thing that I liked his gratuitous trailing return style :)
 
And then I had a brain fart and conflated Alf and Ralf, sorry. :)
--
"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>
ruben safir <ruben@mrbrklyn.com>: Dec 20 08:01AM -0500

In a typical syntax for an assignment operator, it might look like this:
 
T& operator=(const T& other) // copy assignment
{
if (this != &other) { // self-assignment check expected
if (other.size != size) { // storage cannot be reused
delete[] mArray; // destroy storage in this
size = 0;
mArray = nullptr; // preserve invariants in case
next line throws
mArray = new int[other.size]; // create storage in this
size = other.size;
}
std::copy(other.mArray, other.mArray + other.size, mArray);
}
return *this;
}
 
 
I have an example in my code that looks like this:
 
143 STATE & operator = (cost b)
144 {
145 r(b);
146 return *this;
147 }
 
 
So, I've forgotten what this is returning exactly.
 
A reference to a pointer to this is being being returned ?
 
what is that?
bitrex <bitrex@de.lete.earthlink.net>: Dec 20 08:50AM -0500

On 12/20/2017 08:01 AM, ruben safir wrote:
 
> So, I've forgotten what this is returning exactly.
 
> A reference to a pointer to this is being being returned ?
 
> what is that?
 
"this" is a pointer to the particular instance of the STATE class being
used for the assignment, *this is a _value_, and then that value is
returned from the operator overload by reference. Looks like it's being
used to modify some internal field of the class "in place" as in this
dummy example:
 
#include <iostream>
 
typedef double cost;
 
class State
{
public:
State(cost init_cost) : r_{init_cost}
{}
 
State& operator=(cost b)
{
r(b);
return *this;
}
 
operator double() const
{
return r_;
}
 
private:
cost r_;

void r(cost new_cost)
{
//First rule of government spending:
//Why have one when you can have two,
//at twice the price
 
r_ = new_cost*2;
}
};
 
int main()
{
auto my_state = State{5.0};
my_state = 6.0;
std::cout << my_state << std::endl;
}
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 20 04:10PM +0100

On 12/20/2017 2:01 PM, ruben safir wrote:
> }
> return *this;
> }
 
If the `new` expression throws then the current object is left in an
invalid state, with no buffer.
 
I.e. this code is not exception safe.
 
One way to fix it: do the allocation before the allocation, and bail out
of it fails (a simple way is to just let the exception propagate).
 
 
> 145 r(b);
> 146 return *this;
> 147 }
 
This looks like a specialized assignment operator, not a copy assignment.
 
 
> So, I've forgotten what this is returning exactly.
 
The code says it returns a `STATE&`.
 
 
> A reference to a pointer to this is being being returned ?
 
No, a reference to the object that `this` points to.
 
 
> what is that?
 
`this` points to the object that the member function is called on.
 
 
Cheers & hth.,
 
- Alf
"James R. Kuyper" <jameskuyper@verizon.net>: Dec 20 11:16AM -0500

On 12/20/2017 10:10 AM, Alf P. Steinbach wrote:
> ... do the allocation before the allocation ...
 
I think you meant to write something different.
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: