Monday, July 20, 2015

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

legalize+jeeves@mail.xmission.com (Richard): Jul 20 10:52PM

[Please do not mail me a copy of your followup]
 
Paul <pepstein5@gmail.com> spake the secret code
 
>Suppose, for example, that I'm designing a tree where the number of
>nodes descending from any particular node is variable. Any reason not
>to put nodes in vectors of std::unique_ptr<T>
 
Use shared_ptr<> and unique_ptr<> to indicate ownership lifetimes.
 
There's no reason to stop using local variables (including parameters)
that are raw pointers when it is clear that this does not imply a
transfer of ownership.
 
Usually, but not always, a container of items allocated on the heap
manages the lifetime of those items. If those items are shared, then
it's a container of shared_ptrs, if those items are uniquely owned by
the container, then it's a container of unique_ptr.
 
There are times when a container does not manage the lifetime of the
pointers inside it (temporary data structures built up during
processing are a good example) and in these cases, it could be
disastrous to have a container of smart pointers because the container
doesn't own the resources pointed to by the raw pointers.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
legalize+jeeves@mail.xmission.com (Richard): Jul 20 06:59PM

[Please do not mail me a copy of your followup]
 
Louis Krupp <lkrupp@nospam.pssw.com.invalid> spake the secret code
 
>And what's C++ all about, if it's not about being pedantic? :)
 
s/C++/comp.lang.c++/ and I'm in agreement.
 
A tautology is a thing that is tautological.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
doctor@doctor.nl2k.ab.ca (The Doctor): Jul 20 03:02PM

Got a weird, maybe some gurus might be able to help me out.
 
By mistake I tpe gmke -j .
 
Gmake being gnu make.
 
since then on one system, the C compiler has not beeing working properly.
 
Test errors, programmes not seeing the correct data,
socket not starting ...
 
 
What can I do to rectify this situation?
--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k Look at Psalms 14 and 53 on Atheism
Abuse a man unjustly, and you will make friends for him. -Edgar Watson Howe
James Kuyper <jameskuyper@verizon.net>: Jul 20 01:39PM -0400

On 07/20/2015 11:02 AM, The Doctor wrote:
 
> Test errors, programmes not seeing the correct data,
> socket not starting ...
 
> What can I do to rectify this situation?
 
The -j option should only directly affect the files created by the run
of gmake where you used that option. The effect might propagate to other
things that were built using one of those files. If you erase all such
files, and start over again, any problem actually related to your use of
the -j option should disappear.
 
I strongly suspect that many, if not all, of the symptoms you describe
had nothing to do with your use of the -j option - there's no obvious
reason why they should. If I'm right about that, you can expect those
symptoms to continue occurring until you track down and correct the
actual cause of those problems.
Keith Thompson <kst-u@mib.org>: Jul 20 11:23AM -0700

> Got a weird, maybe some gurus might be able to help me out.
 
> By mistake I tpe gmke -j .
 
> Gmake being gnu make.
 
I presume you mean that you typed "gmake -j". I don't usually complain
about typos, but these make your question difficult to read.
 
 
> Test errors, programmes not seeing the correct data,
> socket not starting ...
 
> What can I do to rectify this situation?
 
The "make" command will execute whatever commands are specified in the
default Makefile. Those commands will have whatever effect they would
have if you typed them at a shell prompt. Without knowing what's in
your Makefile, it's impossible to know what your "gmake -j" command has
done.
 
There's a convention for Makefiles to have a "clean" target which will
remove any generated files. It's possible that typing "gmake clean"
will undo whatever damage you've done. I accept no responsibility for
any consequences, which again are entirely dependent on the contents of
the Makefile.
 
(The default makefile may or may not be called "Makefile". Consult the
documentation for details.)
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Andre Zunino <neyzunino@hotmail.com>: Jul 19 10:06PM -0400

On 07/18/2015 10:05 PM, Öö Tiib wrote:
 
>> I've been using it like that and have not run into any problems, but I'd
>> like to know where I'm stepping.
 
> Yes, tell us why you use it?
 
No special reason, really. I just wanted to treat those objects as
"Sprite" without doing dynamic allocation or introducing a new
identifier, like:
 
Toon t1 = Toon {...};
Sprite& s1 = t1;
 
Honestly, I suppose I was just trying to challenge myself by forcing me
to deal with such questionable requirements. But thank you for answering.
 
Best regards,
 
--
Andre Zunino
Gareth Owen <gwowen@gmail.com>: Jul 20 07:22AM +0100

> identifier, like:
 
> Toon t1 = Toon {...};
> Sprite& s1 = t1;
 
't1' is already a Sprite, and can be treated as one in every context
where it makes sense to do so. That is how public inheritance works
(see Liskov Substitution Principle).
"Öö Tiib" <ootiib@hot.ee>: Jul 20 02:32AM -0700

On Monday, 20 July 2015 05:06:41 UTC+3, Andre Zunino wrote:
> identifier, like:
 
> Toon t1 = Toon {...};
> Sprite& s1 = t1;
 
It is difficult to work with dynamic polymorphism without doing
dynamic allocations. Above case is lucky and so no dynamic
polymorphism is needed since we do know that it is 'Toon'.
There are no need to type 'Toon' twice above however in
order to try to nail the fact deeper into our brains. :) Type:
 
Toon t1{ /*...*/ };
 
The 't1' will be treated as 'Sprite' already everywhere without
additional identifiers needed since 'Sprite' is 'Toon's public
base class. So it is shorter to type and works better.
 
> Honestly, I suppose I was just trying to challenge myself by forcing me
> to deal with such questionable requirements. But thank you for answering.
 
With dynamic polymorphism there are some things that should
not be even attempted. All that cppy, move, passing by value, 'swap'
etc. simply does not work polymorphically.
JiiPee <no@notvalid.com>: Jul 20 12:32AM +0100


> https://github.com/vygr/C-Chess
 
> Best regards
 
> Chris
 
Nice looking code.
 
tried with codeblocks and GCC 4.9 but did not compile, pchess.cpp
"C:\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\tuple|1102|error:
value-initialization of reference type 'std::array<int, 64ull>&'|"
JiiPee <no@notvalid.com>: Jul 20 12:42AM +0100


> https://github.com/vygr/C-Chess
 
> Best regards
 
> Chris
 
I get two errors. the other one is:
"C:\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\tuple|1102|error:
value-initialization of reference type 'std::vector<move>&'|"
 
I guess that can be fixed manually from the code? seems like some
initialization problem.
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: