- Declare function in C++ - 5 Updates
- St. Paul, Minnesota - 2 Updates
- What is "TP_NUM_C_BUFS"? - 1 Update
Victor Bazarov <v.bazarov@comcast.invalid>: Apr 13 04:38PM -0400 On 4/13/2016 4:01 PM, Daniel wrote: >> There is no modification of a *member* here. So, yes, *entirely*. > From the user's point of view, the function is mutating data that is owned > by the object. "Ownership" is not a language feature. The object's data member is 'x' and *it* is not changed. The same would go if the member were a reference to it, in which case there is no ownership at all. A 'const' member function adheres to a contract not to modify the 'this' object and it doesn't. The compiler ensures it. V -- I do not respond to top-posted replies, please don't ask |
"Öö Tiib" <ootiib@hot.ee>: Apr 13 02:18PM -0700 On Wednesday, 13 April 2016 23:01:33 UTC+3, Daniel wrote: > > There is no modification of a *member* here. So, yes, *entirely*. > From the user's point of view, the function is mutating data that is owned > by the object. C++ has never had transitivity of constness (or volativeness) through pointers or references (or smart pointers). There is transitivity of constness to members of containers or arrays. What is "users point of view" goes from wall to wall. If you need that transitivity for your "owned objects" (that raw pointer member does no way insist) then you can write your "owner_ptr" smart pointers that do have that problem "fixed" and then use only those as members. |
Daniel <danielaparker@gmail.com>: Apr 13 02:36PM -0700 On Wednesday, April 13, 2016 at 4:38:35 PM UTC-4, Victor Bazarov wrote: > and *it* is not changed. The same would go if the member were a > reference to it, in which case there is no ownership at all. A 'const' > member function adheres to a contract not to modify the 'this' object Which is a meaningless contract from the point of view of the user of the class, the user couldn't care less whether, say, the length and width of an object are stored as size_t length_, size_t width_ or as size_t*. These are implementation details. It's just an illustration that the semantics of const don't correspond to any sensible idea of immutability, and basically amounts to a language hack. Daniel |
"Öö Tiib" <ootiib@hot.ee>: Apr 13 02:54PM -0700 On Thursday, 14 April 2016 00:36:32 UTC+3, Daniel wrote: > are implementation details. It's just an illustration that the semantics of > const don't correspond to any sensible idea of immutability, and basically > amounts to a language hack. Storing length and width as 'size_t[2]' or as 'std::array<size_t,2>' or as 'std_pair<size_t,size_t>' may make sense but why to store those as a raw pointer? If you want to over-engineer so badly then use 'std::vector<size_t>' and you have your transitive constness. |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 13 11:14PM +0100 On Wed, 13 Apr 2016 15:50:52 -0400 > > } > > }; > There is no modification of a *member* here. So, yes, *entirely*. Not really "entirely". Static data members can be modified by const member functions. But perhaps you don't regard them as "members"? Chris |
"Öö Tiib" <ootiib@hot.ee>: Apr 13 02:46PM -0700 On Wednesday, 13 April 2016 19:00:35 UTC+3, woodb...@gmail.com wrote: Seems that you did chose wrong forum to announce it. Here are only dozen or so regulars and maybe twice more casual posters and lurkers. That is perhaps why there are only such sarcastic feedback. > "For two whole years Paul stayed there > in his own rented house and welcomed all who came to see him." Acts 28:30 Does that puzzle mean that the C++ meeting in St. Paul, Minnesota that you organize will last two whole years? I always assumed organizers of such things post the invitations directly to people and organizations that they would like to see participating. Such invitations typically include times, dates and agendas. Sometimes they also phone personally or contact over Skype and ask for opinion or advice and the like. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 13 11:01PM +0100 >> Brian, initially I thought you might have been a follower of Judaism > Hi, Leigh. I'm not the greatest apologist. I hope you > will leave off with the bad words. Apologists are fucktards that like to stick carrots up their arses before they start regurgitating the same old bullshit arguments they have regurgitated many times before. /Flibble |
Paavo Helde <myfirstname@osa.pri.ee>: Apr 13 10:03AM +0300 On 13.04.2016 3:23, Robbie Hatley wrote: > I suppose stack corruption could even > cause worse things (over-writing disk files, damaging hardware, etc). Standard example is sending nasty e-mails to your boss. > Which is why I don't use C for complex programs. Too dangerous. I'll leave > that to people more skilled than me. > C++ is better in that regard, what with std::vector<int> instead of C++ is inherently not much safer, one can always still write code like std::sort(vec.begin(), vec.begin()+87); I think it's just that the style and habits used in C++ are different, so one is strongly inclined to write safer constructs like std::sort(vec.begin(), vec.end()); Cheers Paavo |
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