Friday, June 10, 2016

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

Melzzzzz <mel@zzzzz.com>: Jun 11 12:43AM +0200

https://yro.slashdot.org/story/16/06/10/1350245/visual-studio-2015-c-compiler-secretly-inserts-telemetry-code-into-binaries
legalize+jeeves@mail.xmission.com (Richard): Jun 09 10:30PM

[Please do not mail me a copy of your followup]
 
Wouter van Ooijen <wouter@voti.nl> spake the secret code
 
>I teach more than I program, but I use override whenever possible, and I
>require the students to use it. And I'd like a (gcc) command line
>parameter to make it a warning when it is omitted!
 
It seems there's a little bit of help from the compiler:
<http://stackoverflow.com/questions/29145476/requiring-virtual-function-overrides-to-use-override-keyword>
 
Also, clang-tidy can be run to detect places where override *could* be
used without making any changes to your program.
 
So you could use clang-tidy as a lint-like tool that simply reports
the problem without doing anything about it.
--
"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>
Paavo Helde <myfirstname@osa.pri.ee>: Jun 10 08:15AM +0300

On 9.06.2016 23:30, Lynn McGuire wrote:
> retroactively adding it to our code with some surprising new errors. We
> are using Visual Studio C++ 2015.
> http://en.cppreference.com/w/cpp/language/override
 
Have been using it for many years already (it was available in MSVC long
before being standardized). Helps a lot during refactoring.
Marcel Mueller <news.5.maazl@spamgourmet.org>: Jun 10 09:03AM +0200

On 09.06.16 22.35, Ian Collins wrote:
> virtual function virtual.
 
> I haven't found any new errors, but it does make the code easier to read
> knowing a member function is virtual in the base class.
 
I leave it up to the IDE to identify overrides. This is more reliable.
 
 
Marcel
legalize+jeeves@mail.xmission.com (Richard): Jun 10 05:53PM

[Please do not mail me a copy of your followup]
 
Marcel Mueller <news.5.maazl@spamgourmet.org> spake the secret code
 
>I leave it up to the IDE to identify overrides. This is more reliable.
 
Nothing is more reliable than the compiler, IMO. IDEs are notorious
for taking shortcuts that result in false positives or negatives.
--
"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>
Lynn McGuire <lmc@winsim.com>: Jun 10 04:29PM -0500

On 6/9/2016 5:10 PM, Good Guy wrote:
>> We are using Visual Studio C++ 2015.
 
> With RC3?
 
> <https://blogs.msdn.microsoft.com/visualstudio/2016/06/07/visual-studio-2015-update-3-rc/>
 
No way. This is production code.
 
Lynn
"Fred.Zwarts" <F.Zwarts@KVI.nl>: Jun 10 09:07AM +0200

"Cholo Lennon" schreef in bericht news:njc5mt$6r6$1@gioia.aioe.org...
 
>> I have no idea what »CIN« refers to.
 
>C'mon... you know it (we all know it)!
>Why this newsgroup is so hostile to newcomers/newbies?
 
Frustration probably, because the compiler we have to work with every day is
equally hostile. :)
Andrew Z <formisc@gmail.com>: Jun 10 01:26PM -0700

On Thursday, June 9, 2016 at 1:21:10 PM UTC-4, Barry Schwarz wrote:
 
> >that is another question i had - in the book this loop is _after_ all read/wrte to std was done. so in my mind, by the time "when" starts to execute, CIN has no data (empty stream since everything was already read) and the loop should be infinite. It seems that i do not understand how iostreams is implemented/designed. Where can i read on it in "beginners" words?
 
> C++ is case sensitive. It will eliminate confusion (and snide
> remarks) if your text reflects this.
 
Got it. Thank you for pointing out.
 
 
> What do you mean when you say cin is empty?
 
Barry,
thank you for help.
This is how i _imagine_ the cin works.
[code]
cout<< " Please enter your First name: ";
string name;
cin >> name ;
cout << "Hello, " << name << "!" << endl ;
[/code]
So at line 3 (cin >> name), the value read from cin is assigned to "name".
Now, lets say i want to ask for input twice:
[code]
cout<< " Please enter your First name: ";
string name;
cin >> name ;
cout << "Hello, " << name << "!" << endl ;
string Lname;
cout<< " Please enter your Last name: ";
cin >> Lname ;
cout << "Hello, " << name << "!" << endl ;
[/code]
The cin has value(s) for "name" first and then (after some time) values for "Lname".
(again -in my mind) After i read the input (into a variable) the cin gets cleared out, and the next input value can be read. This is obviously wrong, since a "while" condition, obtains values for everything that was entered previously.
Here is the complete original code:
[code]
int main() {
cout<< " Please enter your First name: ";
string name;
cin >> name ;
cout << "Hello, " << name << "!" << endl ;
cout << "Please enter your Midterm and Final exam grades: " ;
double midterm, final;
cin >> midterm >> final ;
 
// ask for homework grades
cout << " Please enter your Homework grades, "
" Followed by the end-of-flle: " ;
 
// the number and sum of the grades read so far
int count = 0;
double sum = 0;
// the variable into which to read
double x ;
/*
invariant:
we have read count grades for far, and sum is the sum of the first count grades
*/
 
while (cin >> x) {
++count;
sum += x ;
}
// rest of the code is removed.
return 0;
}
[/code]
 
Thank you.
Jerry Stuckle <jstucklex@attglobal.net>: Jun 09 09:55PM -0400

On 6/9/2016 12:51 PM, Öö Tiib wrote:
>>> comp.lang.php. At same time you did never post to any of C or C++ groups.
 
>> Yea, right. If you discuss what you are proficient in, why are you here?
 
> I did not write that I am proficient in something.
 
Ah, but you are quite proficient - in trolling.
 
>> And posting in this newsgroup is NO measurement of proficiency. If it
>> were, there would be about 12 C++ programmers in the whole world.
 
> I did not write that posting is measurement of proficiency.
 
You're the one who claimed that since I've only posted in this newsgroup
since January, I can't be proficient in C.
 
Just another troll backpedal.
 
 
>> people who are proficient in two or even three or more languages.
 
> I did not claim even proficiency in my mother tongue above.
> WTF are you squirming there? Those things were not under discussion.
 
Who said anything about your mother tongue? I sure didn't.
 
> follow from anything I wrote. You hope to dodge a simple question with
> such empty insults and nonsense? That proves that you lie and try to
> wriggle out with those insults.
 
Nope, every post is a direct response to YOUR claims.
 
> I wrote that people who have proficiency and focus discuss it in some
> related forum. It does no way follow from it that people who discuss
> something in some forum have proficiency in subject there.
 
So according to you, since I haven't discussed C in this newsgroup (it
is NOT a "forum"), I am not proficient in C. So according to you, there
are maybe a dozen people in the world who are proficient in C, because
that's about all that post here.
 
Another troll claim.
 
> what I claimed about you that you maybe know PHP or may
> be just troll there but C and C++ gained your attention only
> recently.
 
Again, according to you there are only a dozen or so people in the world
who are proficient in C, because that's about all who post here.
 
Posting or not posting in ANY newsgroup is NEVER a measure of
proficiency. But trolls aren't smart enough to understand such simple
logic.
 
>> you thinking I am lying - to quote Rhett Butler, "Frankly, my dear, I
>> don't give a damn."
 
> I do not know nor care. I can not even know why to lie about such things.
 
And why would I lie about it? You claim that I lie - let's see you
prove it - or apologize. But I know you won't do either - trolls never do.
 
>> companies on three continents (North America, Europe and Asia).
 
> That is again just bald assertion that does convince no one since plain
> logic shows that you lie.
 
Once again, prove your claim or apologize. But I know you won't do
either - trolls never do.
 
>> proof of that.
 
>> But again, just more proof that you are just an ignorant troll.
 
> I really do not know why you care what I think.
 
I don't. But I'm just pointing out what a stoopid troll you are. Even
stoopeder than most trolls.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
ram@zedat.fu-berlin.de (Stefan Ram): Jun 09 11:39AM

>long period of time then, potentially, by checking number of
>values sent with the code above, i could run into memory or
>type length problems...
 
I have no idea what »CIN« refers to.
 
The code you showed is a teaching example simplified
for beginners. It will not necessarily be written this
way to count the votes for the president's election.
 
It needs to be put into context, for example,
 
struct S
{ S & operator ++() { return *this; }
S operator ++( int ) { return *this; }
S & operator +=( const S & o ){ return *this; }
operator bool(){ return false; }};
inline S & operator >>( S & object, S & object1 )
{ return object; }
 
int main()
{ S cin, x, count, sum;
 
while (cin >> x) {
++count;
sum += x ;
}
 
}
 
Thus, one should post complete programs.
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: