Tuesday, January 26, 2016

Digest for comp.lang.c++@googlegroups.com - 9 updates in 4 topics

Paavo Helde <myfirstname@osa.pri.ee>: Jan 26 09:57PM +0200

On 26.01.2016 21:25, Bill Cunningham wrote:
> thought runtime memory management that's smart! Now I've never seen the
> scoping operator used twice as above. I've also never seen at() or
> operator[](). Guess I have some things to check into.
 
Automatically growing the array upon out-of-range access would probably
just hide bugs. On the other hand, there are other containers which
indeed add missing elements automatically. E.g.
 
 
std::map<int, int> buff;
buff[0] = 1;
buff[100000] = 2;
 
Note that here the 'buff' container contains 2 elements (not 100001).
 
About vector details see e.g.
 
http://www.cplusplus.com/reference/vector/
http://www.cplusplus.com/reference/vector/vector/operator%5B%5D/
http://www.cplusplus.com/reference/vector/vector/at/
 
hth
Paavo
Victor Bazarov <v.bazarov@comcast.invalid>: Jan 26 03:35PM -0500

On 1/26/2016 2:50 PM, Scott Lurndal wrote:
 
> And in neither case is the dynamic array "initialized". The pointer
> will have a valid value, but the contents to which it points are
> UNDEFINED.
 
<shrug> I presumed the OP asked how to *allocate* it and use a wrong
term. Since Bill stated that the 'malloc' approach "worked", the
solution offered had supposedly the same effect.
 
V
--
I do not respond to top-posted replies, please don't ask
Vir Campestris <vir.campestris@invalid.invalid>: Jan 26 11:18PM

On 26/01/2016 19:25, Bill Cunningham wrote:
> thought runtime memory management that's smart! Now I've never seen the
> scoping operator used twice as above. I've also never seen at() or
> operator[](). Guess I have some things to check into.
 
What nobody has mentioned is that malloc must have a matching free. And
it must be there on _all_ the error paths.
 
Whereas with the C++ methods you just create your vector, and when it
goes out of scope the language cleans it up for you.
 
Andy
JiiPee <no@notvalid.com>: Jan 26 08:09PM

On 26/01/2016 02:05, Ian Collins wrote:
>> seem to teach so much the language features.
>> A book which teaches all C++ features but correctly (in "Bjarnes" way).
 
> The C++ Programming Language, 4th edition.
 
I know that it a top book... but I think its too heavy for a total
beginner who needs to quicker be able to get basics... you know what I
mean? How about some book like "dummies"? I think even Bjarne said or
agreed that this is not to be the first book....
 
I think its the best C++ book, but maybe not for beginners
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jan 26 09:40PM +0100

On 1/26/2016 12:49 AM, JiiPee wrote:
 
> Bjarnes "Principles and Practice Using C++" seems ok, but it does not
> seem to teach so much the language features.
> A book which teaches all C++ features but correctly (in "Bjarnes" way).
 
The SO C++ book list was very good before a silly moderator decided to
change it to his preferred answers only and close it as a list of
contributions: now it's boiled down to bullet points in a single answer.
 
Anyway,
 
<url:
http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list>
 
There is also a FAQ item about this question, but it's sort of narrow,
not particularly much community contribution there, if any:
 
<url: https://isocpp.org/wiki/faq/how-to-learn-cpp#best-book>
 
I think the FAQ was better in the old days, when one could just discuss
things with Marshall Cline. Most of the ISO CPP FAQ is his old FAQ. It
even includes Marshall's [1] reference to my old C++ tutorial that's
been off-line for about 15 years or so – Marshall kept the reference
in the hope that I would revive and complete the tutorial, and he even
offered to host it, but for various reasons that didn't happen.
 
 
Cheers & hth.,
 
- Alf
 
Notes:
[1] In <url: https://isocpp.org/wiki/faq/newbie#newbie-more-info>.
JiiPee <no@notvalid.com>: Jan 26 09:17PM

On 26/01/2016 20:40, Alf P. Steinbach wrote:
 
> There is also a FAQ item about this question, but it's sort of narrow,
> not particularly much community contribution there, if any:
 
> <url: https://isocpp.org/wiki/faq/how-to-learn-cpp#best-book>
 
ok, so " Programming: Principles and Practice using C++" ..
<http://www.stroustrup.com/programming.html>
I guess its a good choice
<http://www.stroustrup.com/programming.html>
Ian Collins <ian-news@hotmail.com>: Jan 27 11:22AM +1300

JiiPee wrote:
> mean? How about some book like "dummies"? I think even Bjarne said or
> agreed that this is not to be the first book....
 
> I think its the best C++ book, but maybe not for beginners
 
It depends what you are calling a beginner: someone new to programming,
or a programmer new to C++? The C++ Programming Language probably
wouldn't be appropriate for the former, but it would be for the latter.
 
--
Ian Collins
JiiPee <no@notvalid.com>: Jan 26 07:50PM

On 26/01/2016 14:24, David Brown wrote:
> Lambdas and nullptr are nice too.
 
i like very much nullptr, ... no more pondering whether to use 0 or
create some NULL stuff.... now its clear what to use everywhere. I did
not like that zero:
 
int* p = 0;
JiiPee <no@notvalid.com>: Jan 25 11:57PM

On 25/01/2016 21:46, Waqas Ahmed wrote:
 
> 1: SQL Data Analyst | New York, NY
 
> Requirements:
> - Minimum of 2 years of experience in a data analyst role, with increasing levels of responsibility
 
I have more than 3 years c++ experience, but I live in London :). Can I
get a green card as well??
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: