- the new {} syntax - 2 Updates
- primary expression - 4 Updates
- Failed interview test - 13 Updates
- creating a binary tree - 2 Updates
- "Use Stronger Types!" - 1 Update
- Static member in standard library - 1 Update
- binary_search - 2 Updates
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 22 02:55PM +0100 On 21.11.2016 21:50, ruben safir wrote: > Alf, your no gem either. Reconsider what your saying because your way > off and if you were one of my children at the table, would be sent > upstairs to mull over things. No need to get personal, the ad hominem. Just take to heart that in your defense of one person who erred, you effectively supported an incorrect and misleading view of the technical. This is first and foremost a technical group (even though, unlike its now defunct moderated sister group, it lacks a charter). If you want a more social forum, one that actively discourages technical discussion and encourages social up- and down-voting, there's Stack Overflow for you, the greatest Herb Schildt zone on the net. Personally I treat SO as a technical forum in the hopes of helping to preventg changes to the worse, but there's many people there who, like you, seem to revel in the opportunities to focus on social games: defending this person, attacking that person, projecting a false image, just like you did now. Cheers & hope you fuck off, - Alf |
ruben safir <ruben@mrbrklyn.com>: Nov 22 11:54AM -0500 On 11/22/2016 08:55 AM, Alf P. Steinbach wrote: > Just take to heart that in your defense of one person who erred, you > effectively supported an incorrect and misleading view of the technical. My lexer can't parse this. Not even with antlr |
Popping mad <rainbow@colition.gov>: Nov 21 11:40PM On Mon, 21 Nov 2016 15:18:47 -0700, Louis Krupp wrote: > and it covers at least some of what's changed in C++11. Amazon lists > other titles. Read the reviews, buy whatever looks good from Amazon or > locally, and happy reading. Thanks Currently I'm working with Stroustrup 4th edition, Guntheroth Optimized C+ + 1st ed, Williams, C++ Concunrancy 2012, Vandevoodre Templates 12th print 2010, Lipman and Lajoie C++ primer3rd edition 1998, Corman Allgorithms and a few other texts on PNG, a C++ with pthreads and using GCC by RMS |
Jerry Stuckle <jstucklex@attglobal.net>: Nov 21 09:25PM -0500 On 11/21/2016 6:12 PM, Christopher J. Pisz wrote: >> Yes, at least it is always 100% truthfull :). It does not tell lies... > I learned C++ from this newsgroup, Victor, Alf, and Oo Tiib. You have my sympathy... -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Nov 21 11:43PM -0700 On Mon, 21 Nov 2016 23:40:41 +0000 (UTC), Popping mad >print 2010, Lipman and Lajoie C++ primer3rd edition 1998, Corman >Allgorithms and a few other texts on PNG, a C++ with pthreads and using >GCC by RMS Based on reviews of Stroustrup's book, I would recommend reading something simpler but up to date first. Then, when you run into something that doesn't work the way you expect it to, take some time to figure it out using just your experience, the books, and whatever information you can find online. Don't post anything unless you're really desperate. Believe it or not, this is more or less what programmers did for hundreds (OK, dozens) of years before Internet. We couldn't look stuff up online because there was no such thing, and we certainly couldn't ask anyone unless they were down the hall and we could walk into their office and show them a listing (when we printed a program, we called it a listing) or write stuff on their whiteboard, but that was only if they had a whiteboard. Whiteboards weren't really a thing in a lot of places until about 25 or 30 years ago. So we read books and manuals and we reread them and we read programs that other people had written and which worked and we tried things and eventually we figured stuff out, and we were proud of ourselves. It might be frustrating at first, but you'll get good at it, and then when other people post questions, you'll be the one posting answers. Louis |
ruben safir <ruben@mrbrklyn.com>: Nov 22 11:51AM -0500 On 11/22/2016 01:43 AM, Louis Krupp wrote: > office and show them a listing (when we printed a program, we called > it a listing) or write stuff on their whiteboard, but that was only if > they had a whiteboard. W back then. when I used to program, first of all the languages were far simpler and secondly I had access to a broad range of coworkers and student. But that was a long time ago, and it wasn't unusual to work with punch cards. Our workspace was freezing because of the the AC, and we had to maintain a lot of the HW. SInce the mid-1990's we've had access to usenet and sometimes irc. |
Daniel <danielaparker@gmail.com>: Nov 21 03:48PM -0800 > On Sunday, November 20, 2016 at 12:10:03 PM UTC-6, Mr Flibble wrote: > Please don't swear here. CNN had an article about how Trump's insults embolden secret sexists, nonetheless, I'm hopeful that Mr Flibble's use of the C word was an aberration, in this newsgroup. Daniel |
legalize+jeeves@mail.xmission.com (Richard): Nov 21 11:56PM [Please do not mail me a copy of your followup] Paavo Helde <myfirstname@osa.pri.ee> spake the secret code >difference, if something is not an object, then it does not (logically) >have an address, it does not (logically) occupy memory, and in general >acts more like some kind of compile-time feature than a run-time entity. Pointers occupy memory. Pointers have addresses. -- "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> |
"Chris M. Thomasson" <invalid@invalid.invalid>: Nov 21 05:19PM -0800 On 11/21/2016 3:48 PM, Daniel wrote: > CNN had an article about how Trump's insults embolden secret sexists, nonetheless, > I'm hopeful that Mr Flibble's use of the C word was an aberration, in this > newsgroup. No reason not to also include Bill's flamboyant adventures into the realm of touching, and other unwanted exotic oddities... I really do not trust either of them! Gross. Damn. |
Jerry Stuckle <jstucklex@attglobal.net>: Nov 21 09:26PM -0500 On 11/21/2016 6:56 PM, Richard wrote: >> acts more like some kind of compile-time feature than a run-time entity. > Pointers occupy memory. > Pointers have addresses. Maybe. If the code never takes the address of the pointer, it could very easily reside in a register and not occupy any memory. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ================== |
Daniel <danielaparker@gmail.com>: Nov 21 06:28PM -0800 On Monday, November 21, 2016 at 8:19:25 PM UTC-5, Chris M. Thomasson wrote: > No reason not to also include Bill's flamboyant adventures .. You know, for a moment I thought you were referring to some other newsgroup participant, one whose name I didn't recognize off hand... > I really do not trust either of them! And for a moment I thought you were referring to this Bill and Mr Flibble :-) In any case, even though this forum does not appear to have many female visitors, I hope that none of us would wish to make them feel unwelcome with our words. Daniel |
David Brown <david.brown@hesbynett.no>: Nov 22 08:43AM +0100 On 22/11/16 03:28, Daniel wrote: > In any case, even though this forum does not appear to have many female > visitors, I hope that none of us would wish to make them feel unwelcome with > our words. Mr Flibble's language is not going to scare anyone away from this group. His /attitude/ is sometimes a bit aggressive, and far too stubborn for his own good - but his language is not so "colourful" as to be a problem. Of course, with Brian pointing out every little word that his mummy won't let me say, everyone here sees the swear words that would otherwise have passed unnoticed. If anything would make someone feel unwelcome in this group, it is Brian's obsession about swearing - closely followed by incomprehensible nonsense about sausages from Mr. Flibble. Oh, and why would you think women would feel specially hurt by Mr. Flibble's words? That sounds sexist to me. If I called you a dick (which I would not do), would that be particularly insulting to all male visitors to the group? |
"Christopher J. Pisz" <cpisz@austin.rr.com>: Nov 22 02:36AM -0600 On 11/22/2016 1:43 AM, David Brown wrote: > Flibble's words? That sounds sexist to me. If I called you a dick > (which I would not do), would that be particularly insulting to all male > visitors to the group? What about those that identify as sprinkled donuts? |
David Brown <david.brown@hesbynett.no>: Nov 22 10:04AM +0100 On 22/11/16 09:36, Christopher J. Pisz wrote: > What about those that identify as sprinkled donuts? I guess we'll have to avoid jokes about policemen's diets, to avoid hurting their feelings. |
Daniel <danielaparker@gmail.com>: Nov 22 03:47AM -0800 On Tuesday, November 22, 2016 at 2:43:16 AM UTC-5, David Brown wrote: > Oh, and why would you think women would feel specially hurt ... I never suggested that members of the female persuasion would feel especially hurt. Just that they would probably not be inclined to visit a forum where the c..t word was liberally used, which is suggestive of the grade school level social skills of young adolescent boys. Best regards, Daniel |
David Brown <david.brown@hesbynett.no>: Nov 22 01:25PM +0100 On 22/11/16 12:47, Daniel wrote: > hurt. Just that they would probably not be inclined to visit a forum where the > c..t word was liberally used, which is suggestive of the grade school level social > skills of young adolescent boys. Fair enough. I think many people would not be inclined to stay in a place where such words were used liberally. I just don't think it is worth fussing about occasional swearing, and Brian's auto-responder for swearing is more annoying and simply encourages worse language. It reminds me of a car I once saw at university with a talking car alarm. If you bumped the car it would say things like "Please step back for the car". Of course, the car was covered in dents and scratches made by students who wanted to hear what it would say next! |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 22 06:58AM -0800 >> However a reference may occupy a region of storage like a pointer object. > It may or may not. The standard says: > "It is unspecified whether or not a reference requires storage." What a silly thing to say. This sounds like someone trying to fool themselves into thinking a reference is not just a pointer in disguise. Better to say a reference does occupy storage in the abstract machine, and let the as-if rule take care of things. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 22 04:10PM +0100 On 22.11.2016 15:58, Tim Rentsch wrote: > fool themselves into thinking a reference is not just a pointer > in disguise. Better to say a reference does occupy storage in > the abstract machine, and let the as-if rule take care of things. No, it's a tecnically precise thing to say. The standard defines the term "unspecified": C++11 §1.3.25 [defns.unspecified]: " unspecified behavior behavior, for a well-formed program construct and correct data, that depends on the implementation [Note: The implementation is not required to document which behavior occurs. The range of possible behaviors is usually delineated by this International Standard. —end note ] " A language standard is not a tutorial or textbook. Cheers & hth., - Alf |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 22 07:59AM -0800 >> the abstract machine, and let the as-if rule take care of things. > No, it's a tecnically precise thing to say. The standard defines the > term 'unspecified': [...] Yes, I understand what unspecified means. My objection is not that the statement is imprecise but that it's a poor choice of semantic definition, because it needlessly adds fuzziness. Not fuzziness about what the words mean, but fuzziness about how programs behave. Who was it who said something recently about C++ gratuitously introducing unreliable behavior? This is another example. |
Ike Naar <ike@iceland.freeshell.org>: Nov 22 07:22AM > incase you want to look up. > How can you build this? A recursive function goes straight down the left > side. That's strange, if the ints in the array are random. Can you show the code of the recursive function? |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 22 07:39AM -0800 > incase you want to look up. > How can you build this? A recursive function goes straight down the left > side. Sort the array, then build a balanced tree recursively based on an array parameter. Here is pseudocode written in a C-like language to do the tree building: Tree balanced_tree_from_sorted_array( Size n, signed values[n] ){ if( n == 0 ) return 0; if( n == 1 ) return new_tree_node( values[0] ); if( n == 2 ){ Tree a = new_tree_node( values[0] ); Tree b = new_tree_node( values[1] ); a->right = b, b->parent = a; return a; } Tree a = balanced_tree_from_sorted_array( n/2, values ); Tree b = new_tree_node( values[n/2] ); Tree c = balanced_tree_from_sorted_array( (n-1)/2, values + (n/2+1) ); assert( n/2 + 1 + (n-1)/2 == n ); a->parent = b, b->left = a; c->parent = b, b->right = c; return b; } |
Tim Rentsch <txr@alumni.caltech.edu>: Nov 22 07:30AM -0800 > No, but > if(str1.length()-str2.length() < 12) { ... } > has equally bizarre behaviour. It does, for slightly different reasons. But it's easy to remedy that problem: if(str1.length() < str2.length()+12) { ... } We can do a similar transformation on the original example: string("blah").length()+1 < 0 which will likely result in a compiler warning because the (new) condition is always false. As a general rule expressions with unsigned types should be written to use + rather than -. Returning to the original example, as things turned out just in the last day or two I had occasion to write a comparision if(k < -3) ... where k was an unsigned type (size_t, to be specific), and that formulation fit rather naturally into the rest of the code, given the particular circumstances. Such circumstances however are unusual to say the least and much more often the exception than the rule. |
Juha Nieminen <nospam@thanks.invalid>: Nov 22 09:46AM > #include <memory_resource> Seems to be a C++17 feature. Assuming your compiler supports it at all, you probably need to tell it to use that standard (eg. "-std=c++1z", or "-std=c++17", or whatever the option might be). |
Ike Naar <ike@iceland.freeshell.org>: Nov 22 07:02AM > Why does ::std::binary_search return a boolean? > Why doesn't it return an iterator to the position > found? There can be more than one position that contains the value being searched for. |
Juha Nieminen <nospam@thanks.invalid>: Nov 22 09:41AM >> found? Wouldn't more information sometimes be >> helpful to the caller? > std::lower_bound, std::upper_bound Note, however, that those functions don't actually tell if a value equal to the parameter exists within the range. Instead, they give an iterator which points to the location where you would have to insert the searched value in order to keep the range sorted. (Their difference is that if there exist values within the range that are equal to the one given as parameter, the lower_bound will return the first position where it can be inserted, while upper_bound returns the last position. In either case the range would remain sorted if you insert the value in that position. The location may just be different.) Which means in practice that even if there is no value equal to the one given as parameter within the range, they will still return an iterator that points within the range (or to the end if the value in question would need to be inserted there for the range to remain sorted). With std::lower_bound() you need to make an additional equality check to see if the value pointed by the returned iterator is equal to the searched value. |
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:
Post a Comment