Tuesday, March 20, 2018

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

"James R. Kuyper" <jameskuyper@verizon.net>: Mar 20 09:42AM -0400

> Looking for some example of stellar code for educational purpose. Any recommendations?
 
<https://sourceforge.net/projects/collidinggalaxi/>
<https://sourceforge.net/projects/agbstarviewer/>
<https://sourceforge.net/projects/stellarics/>
woodbrian77@gmail.com: Mar 20 10:28AM -0700

> Looking for some example of stellar code for educational purpose. Any recommendations?
 
https://github.com/Ebenezer-group/onwards
 
The repo is just called onwards, but that's short for
onwards and upwards. By the grace of G-d, I keep working
on the software to make it more robust, efficient,
flexible, etc.
 
 
Brian
Ebenezer Enterprises - Enjoying programming again.
http://webEbenezer.net
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 20 06:03PM

> onwards and upwards. By the grace of G-d, I keep working
> on the software to make it more robust, efficient,
> flexible, etc.
 
Your god doesn't exist mate.
 
/Flibble
 
--
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates
a world that is so full of injustice and pain. That's what I would say."
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 20 12:23PM -0700

On 3/20/2018 6:42 AM, James R. Kuyper wrote:
>> Looking for some example of stellar code for educational purpose. Any
>> recommendations?
 
> <https://sourceforge.net/projects/collidinggalaxi/>
 
Nice! Thank you for that.
 
> <https://sourceforge.net/projects/agbstarviewer/>
> <https://sourceforge.net/projects/stellarics/>
 
Fwiw, C++ can be used in interesting ways:
 
https://youtu.be/-KfI6qZyoQw?t=1938
(Kip Thorne...)
 
;^)
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 20 07:41PM

On Tue, 20 Mar 2018 12:23:01 -0700
 
> Fwiw, C++ can be used in interesting ways:
 
> https://youtu.be/-KfI6qZyoQw?t=1938
> (Kip Thorne...)
 
I have the awful feeling that you may have missed the joke. But
probably you are meeting irony with more irony.
woodbrian77@gmail.com: Mar 20 10:05AM -0700

> PolyCollection imposes it's own ordering of objects added to it.
 
> And is it too early/late to suggest that this library be
> added to the standard? Thanks in advance.
 
I've made some progress on this now and have checked in
support for base_collection here:
https://github.com/Ebenezer-group/onwards
https://github.com/Ebenezer-group/onwards/tree/master/poly
 
Here's some code generated by the C++ Middleware Writer :
https://github.com/Ebenezer-group/onwards/blob/master/poly/zz.testing.hh
 
based on these two input files:
https://github.com/Ebenezer-group/onwards/blob/master/poly/testing.hh
https://github.com/Ebenezer-group/onwards/blob/master/poly/testing.mdl
 
Thanks a lot to Joaquín López Muñoz, the author of the PolyCollection
library, for answering a number of questions I had.
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
computer45 <computer45@cyber.com>: Mar 19 09:20PM -0400

Hello..
 
About scalable reference counting..
 
I have found this Scalable Reference Counting Garbage Collector, and i
think it is the only one invented by two PhDs from Israel:
 
http://www.cs.technion.ac.il/users/wwwb/Reports/1999/CS0967.pdf
 
 
So i have decided to invent and to implement another fully scalable
reference counting algorithm with efficient support for weak references,
it is fully scalable on multicores and manycores systems and here it is:
 
https://sites.google.com/site/aminer68/scalable-reference-counting-with-efficient-support-for-weak-references
 
Hope you will be happy with my project , because since i "love" Delphi,
i have decided to bring the "best" to Delphi, my salable reference
counting algorithm can be ported to C++Builder or to other C++ compilers
also.
 
 
Thank you,
Amine Moulay Ramdane.
Thiago Adams <thiago.adams@gmail.com>: Mar 19 04:32PM -0700

On Wednesday, December 20, 2017 at 6:21:22 PM UTC-2, Thiago Adams wrote:
> 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.
 
I created a simple tool to do the amalgamation:
 
https://github.com/thradams/amalgamation
 
It is very simple (179 lines) and open source.
"Öö Tiib" <ootiib@hot.ee>: Mar 20 12:20AM -0700

On Tuesday, 20 March 2018 01:32:38 UTC+2, Thiago Adams wrote:
 
> I created a simple tool to do the amalgamation:
 
> https://github.com/thradams/amalgamation
 
> It is very simple (179 lines) and open source.
 
Most preprocessor metaprogramming will break, same names in anonymous
namespaces may conflict and same names of statics may conflict.
I did not check if Brian's code has any of that.
Otherwise works.
Thiago Adams <thiago.adams@gmail.com>: Mar 20 05:53AM -0700

On Tuesday, March 20, 2018 at 4:21:04 AM UTC-3, Öö Tiib wrote:
> namespaces may conflict and same names of statics may conflict.
> I did not check if Brian's code has any of that.
> Otherwise works.
 
In my own code I had to make static function names unique
manually.
 
For template code, I think the template code must be merged in
a single header file. And the source code merged in other file without
to expand the template headers. Instead it must include one merged
template file.
 
If I had to to this using the tool I would
do the following:
 
1 - Merge all includes in one file
 
tool merge_h.txt allheaders.h
 
-- merge_h.txt--
 
#include "header1.h"
#include "header2.h"
...
#include "headerN.h"
 
---
 
2 - Merge source files.
Headers files must not be present in this directory
to avoid expansion. They need to be included at the
beginning to avoid subsequent includes of "#include".
 
tool merge_cpp.txt allsource.cpp
 
 
-- merge_cpp.txt--
 
 
////////////cut here after completation ///////////////////
 
#include "header1.h"
#include "header2.h"
...
#include "headerN.h"
 
///////////cut here after completation /////////////
 
#include "allheaders.h"
 
#include "source1.cpp"
#include "source2.cpp"
...
#include "sourceN.cpp"
---
 
 
After generation allsource.cpp I would manually
remove cut here, or just use #if 0 there.
 
 
I don't have a real case for this now, but
the tool can be customized for the template needs.
I can create the "don't expand list" also to
avoid to have to remove the headers I don't want
to expand.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 20 04:45AM -0500


> He's right. Don't do it.
 
> If you see std::vector you _know_ it's the normal one. If you just see
> vector you don't. Especially in old code that pre-dates the STL.
 
Agree.
 
> typedef std::shared_ptr<someclass> buffer;
> or such for half-a-dozen types - and that keeps me having to refer back
> to check what they are.
 
Disagree. Using typedef to give otherwise non-descript generic types
meaningful names is a good idea which I employ a lot. C++ has also
introduced the 'auto' keyword which hides the original type.
 
/Flibble
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Mar 20 01:24AM -0700

I have always used my custom asm for this, but I noticed a while ago
that C++11 can use Double-Width Compare-and-Swap (DWCAS) via a struct
the size of two pointers for atomic operations. Out of interest, I have
constructed the following program that works on MSVC 14.0.25424.00
Update 3. However, on GCC 6.3.0, I am getting the following errors:
____________________________
||=== Build: Debug in ct_experiment (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `std::atomic<ct_dwcas>::is_lock_free()
const':|
C:\msys64\mingw64\include\c++\6.3.0\atomic|212|undefined reference to
`__atomic_is_lock_free'|
obj\Debug\main.o||In function
`std::atomic<ct_dwcas>::load(std::memory_order) const':|
C:\msys64\mingw64\include\c++\6.3.0\atomic|235|undefined reference to
`__atomic_load_16'|
obj\Debug\main.o||In function
`std::atomic<ct_dwcas>::compare_exchange_weak(ct_dwcas&, ct_dwcas,
std::memory_order, std::memory_order)':|
C:\msys64\mingw64\include\c++\6.3.0\atomic|268|undefined reference to
`__atomic_compare_exchange_16'|
||error: ld returned 1 exit status|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
____________________________
 
Here is the code:
____________________________
#if defined (_MSC_VER)
# define _ENABLE_ATOMIC_ALIGNMENT_FIX // for dwcas

No comments: