- Converting constructors - 15 Updates
- Failed interview test - 7 Updates
- Converting constructors - 1 Update
- Custom Memory Manager & placement new - 2 Updates
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 11:31AM +0100 Am 25.11.2016 um 11:09 schrieb Stefan Ram: > - one argument > but > - no "explicit". It is one arguemnt *and* no explicit. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 05:14PM +0100 On 25.11.2016 11:09, Stefan Ram wrote: > But after the C++ primer has so convincingly explained why a > converting constructor is a constructor that accepts a single > argument, why has the standard dropped this requirement? [code] struct A { A( int, int ) {} }; struct B { explicit B( int, int ) {} }; auto main() -> int { A a = {1, 2}; B b = {1, 2}; //! Nyet, constructor is explicit. } [/code] Cheers & hth., - Alf |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 05:16PM +0100 On 25.11.2016 17:14, Alf P. Steinbach wrote: > B b = {1, 2}; //! Nyet, constructor is explicit. > } > [/code] But regarding the practical utility I have no idea. I think it's just some committee member's wet dream, to be able to answer questions like this. Possibly. Cheers!, - Alf |
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 06:06PM +0100 Am 25.11.2016 um 17:14 schrieb Alf P. Steinbach: > B b = {1, 2}; //! Nyet, constructor is explicit. This is not converting operation. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 06:06PM +0100 On 25.11.2016 18:06, Bonita Montero wrote: > Am 25.11.2016 um 17:14 schrieb Alf P. Steinbach: >> B b = {1, 2}; //! Nyet, constructor is explicit. > This is not converting operation. Well, you're entitled to your opinion about what labels fit, but I for one am not very interested in that. So, I suggest you refrain from entirely meaningless commentary, a.k.a. babble, in this group, unless it concerns swearing or sausages. Thank you. Cheers! - Alf |
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 06:20PM +0100 Am 25.11.2016 um 18:06 schrieb Alf P. Steinbach: >>> B b = {1, 2}; //! Nyet, constructor is explicit. >> This is not converting operation. > ... refrain from entirely meaningless commentary, ... This is not meaningless. The code you show doesn't show any comversion. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 06:27PM +0100 On 25.11.2016 18:20, Bonita Montero wrote: >> ... refrain from entirely meaningless commentary, ... > This is not meaningless. > The code you show doesn't show any comversion. Apart from your opinion about labels, which I'll not contest (any person is free to choose his or her own terminology, no matter how impractical it may be, no matter how undefined or meaningless), do you think it's relevant to the OP's question that the `explicit` constructor prevents that line from compiling? Cheers!, - Alf |
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 06:34PM +0100 Am 25.11.2016 um 18:27 schrieb Alf P. Steinbach: > do you think it's relevant to the OP's question that the > `explicit` constructor prevents that line from compiling? The code you postet is absoltuely useless for the question Stefan Ram asked because it doesn't show any conversion -operation. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 08:10PM +0100 On 25.11.2016 18:34, Bonita Montero wrote: > The code you postet is absoltuely useless for the question > Stefan Ram asked because it doesn't show any conversion > -operation. Well, that's just idiocy. - Alf |
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 08:28PM +0100 Am 25.11.2016 um 20:10 schrieb Alf P. Steinbach: >> Stefan Ram asked because it doesn't show any conversion >> -operation. > Well, that's just idiocy. Stefan asked why the standad doesn't make a clear statement about what a converting constructor is except specifying that it might not be explicit. For that question you don't give any clarification with your code because it doesn't show any conversion. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 08:36PM +0100 On 25.11.2016 20:28, Bonita Montero wrote: > what a converting constructor is except specifying that it might > not be explicit. For that question you don't give any clarification > with your code because it doesn't show any conversion. Repeating the idiocy doesn't make it meaningful. Cheers!, - Alf |
Bonita Montero <Bonita.Montero@gmail.com>: Nov 25 08:53PM +0100 Am 25.11.2016 um 20:36 schrieb Alf P. Steinbach: >> not be explicit. For that question you don't give any clarification >> with your code because it doesn't show any conversion. > Repeating the idiocy doesn't make it meaningful. My objection isn't idiocy, but yours. Because the code you supplied doesn't clarify the question Stefan asked for. It simply has nothing to do with the question. -- http://facebook.com/bonita.montero/ |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 09:23PM +0100 On 25.11.2016 20:53, Bonita Montero wrote: > My objection isn't idiocy, but yours. Because the code you supplied > doesn't clarify the question Stefan asked for. It simply has nothing > to do with the question. It seems that by repeating these meaningless assertions, this technical idiocy, you're trolling, waiting for someone else to join in and then accept their explanation as if I hadn't been clear enough. In the posting I'm replying you changed newsgroups to `de.alt.gruppenkasper`, and that's also typical trolling behavior. Plonk. Or if you don't get that, please do fuck off. - Alf |
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Nov 25 01:28PM -0700 On 25 Nov 2016 10:09:48 GMT, ram@zedat.fu-berlin.de (Stefan Ram) wrote: > But after the C++ primer has so convincingly explained why a > converting constructor is a constructor that accepts a single > argument, why has the standard dropped this requirement? According to this page, the single-argument requirement went away with C++11: http://en.cppreference.com/w/cpp/language/converting_constructor Louis |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Nov 25 09:32PM +0100 On 25.11.2016 21:28, Louis Krupp wrote: > According to this page, the single-argument requirement went away with > C++11: > http://en.cppreference.com/w/cpp/language/converting_constructor Stefan is aware of that and explained that as you've quoted above. He asked why, literally, as the last you quoted, "why has the standard dropped this [single argument] requirement". I.e. what impact does it have. As far as I know the only impact is for copy initialization syntax with curly braces initializer, as I've already exemplified. Cheers & hth., - Alf |
woodbrian77@gmail.com: Nov 24 04:52PM -0800 On Tuesday, November 22, 2016 at 6:18:29 PM UTC-6, David Brown wrote: > > Middleware Writer. > I accuse you of fussing about swearing - needlessly, pointlessly, > repetitively, and counter-productively. The swearing is repetitive and counter-productive. Others and I have made the point that it is counter-productive many times. > As for the C++ Middleware Writer being "the elephant in the room" - > well, I know the project means a lot to you, and I wish you every > success. I wonder if someone could persuade Leigh that he shouldn't mess with the C++ Middleware Writer entry on the wikipedia page about serialization. As I said previously, I'm willing to make it clear that the user who is recommending the software is also a developer of the software. Brian Ebenezer Enterprises - Whereas it is the duty of all nations to acknowledge the providence of Almighty God, to obey His will, to be grateful for His benefits, and humbly to implore His protection and favor; and Whereas both Houses of Congress have, by their joint committee, requested me to "recommend to the people of the United States a day of public thanksgiving and prayer ..." George Washington http://webEbenezer.net |
woodbrian77@gmail.com: Nov 24 05:28PM -0800 On Thursday, November 24, 2016 at 12:23:11 PM UTC-6, Richard wrote: > <o1388p$m8i$1@dont-email.me> thusly: > >Just trust me on this. > Or just "If you set a trap for others, you will get caught in it yourself." Proverbs 26:27 Brian Ebenezer Enterprises http://webEbenezer.net |
Daniel <danielaparker@gmail.com>: Nov 24 06:32PM -0800 > I wonder if someone could persuade Leigh that he shouldn't > mess with the C++ Middleware Writer entry on the wikipedia > page about serialization. I could offer to take over from him for a while, if that would help. > As I said previously, I'm willing > to make it clear that the user who is recommending the software > is also a developer of the software. You know that Wikipedia does not accept entries from primary sources. To be mentioned in wikipedia, a secondary source must be cited. Best regards, Daniel |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 25 03:45PM >> repetitively, and counter-productively. > The swearing is repetitive and counter-productive. Others and I > have made the point that it is counter-productive many times. Your fussing about swearing in this forum is repetitive and counter-productive. > page about serialization. As I said previously, I'm willing > to make it clear that the user who is recommending the software > is also a developer of the software. Myself and others will continue to prevent you from advertising your software on Wikipedia. /Flibble |
woodbrian77@gmail.com: Nov 25 09:00AM -0800 On Friday, November 25, 2016 at 9:45:35 AM UTC-6, Mr Flibble wrote: > > have made the point that it is counter-productive many times. > Your fussing about swearing in this forum is repetitive and > counter-productive. I was reading drudgereport.com today and there's a story about two Saudi women being punished for their potty mouths. http://heatst.com/world/saudi-women-sentenced-to-20-lashes-for-swearing-on-whatsapp/ Though it seems your offenses are worse than theirs, I wouldn't sentence you to 20 lashes or the jail time that they received for their potty mouths. > > is also a developer of the software. > Myself and others will continue to prevent you from advertising your > software on Wikipedia. This is further financial attack against me similar to this lady http://www.foxnews.com/us/2016/11/18/hundreds-support-christian-florist-fined-for-refusing-to-work-gay-wedding.html I've never thought of charging atheists to use my service, but these attacks against me make me reconsider that. Brian Ebenezer Enterprises http://webEbenezer.net |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 25 05:52PM >> software on Wikipedia. > This is further financial attack against me similar to this lady > http://www.foxnews.com/us/2016/11/18/hundreds-support-christian-florist-fined-for-refusing-to-work-gay-wedding.html Oh I forgot that you are a homophobic bigot Brian. Unlike when choosing to follow a religion, sexual orientation, gender and race are not choices so it should be illegal to discriminate based on them so the fine is appropriate. An atheist florist refusing to serve a Christian would be entirely appropriate however as being Christian is a lifestyle choice that is itself discriminatory. > I've never thought of charging atheists to use my service, > but these attacks against me make me reconsider that. Nobody cares. /Flibble |
David Brown <david.brown@hesbynett.no>: Nov 25 07:12PM +0100 >>>> repetitively, and counter-productively. >>> The swearing is repetitive and counter-productive. Others and I >>> have made the point that it is counter-productive many times. Occasional swearing is harmless. The repetitive swearing I see in this groups is almost entirely in response to your idiotic "please don't swear" posts. Stop being such a petty, self-righteous prude about language, and the swearing will mostly stop. It is win-win for everyone. > Though it seems your offenses are worse than theirs, > I wouldn't sentence you to 20 lashes or the jail time > that they received for their potty mouths. Saudi Arabia has an obscene and inhumane legal system. I presume you do not consider it a model for follow - so why bring it up? No one here has committed any offences. The women in the report (assuming, for the moment, that it is true - Drudge Report is not known for its accuracy) broke the law in their country, and were punished according to those laws. The laws there may be terrible, but they are still the law of that country. Mr. Flibble has broken no laws of any sort in his posts, as far as I can tell. >> Myself and others will continue to prevent you from advertising your >> software on Wikipedia. > This is further financial attack against me similar to this lady No, it is not an "attack" on you or your products or business. Quite simply, Wikipedia is not an advertising site. Its rules require that someone other than the developer and seller of your Middleware Writer should write such articles. If /you/ write it, it would be advertising - just as if Mr. Flibble were to write an article describing how Flibble Sausages were the most delicious in the world, and anyone can order them from his website. So find one of your satisfied customers, and ask /them/ to write an article (in their own words - not re-posting /your/ words). If there are no customers or users of the Middleware Writer who find it so useful that they are willing to make this effort, then perhaps it is not software that is interesting enough to bother having it mentioned on Wikipedia. As it stands, every time you break the rules of Wikipedia, someone fixes the breakage - that sounds fair enough to me. > http://www.foxnews.com/us/2016/11/18/hundreds-support-christian-florist-fined-for-refusing-to-work-gay-wedding.html That is a /completely/ different situation, and bears no comparison to people who want to stop you from damaging Wikipedia. It can be a legally complicated area the extent to which a service provider (such as a shop) can arbitrarily refuse to serve someone. Basically, you need good reason to do so. Depending on the details of the jurisdiction, various types of discrimination are directly illegal. For example, in most European countries, discriminating by sexuality is illegal. It is also illegal in about half the states in the USA. But for some reason, some states reserve the right to be stuck in the middle ages and allow discrimination against gays. It goes against the fundamental American ideas of freedom and equality, but some people have never really bothered about those principles. > I've never thought of charging atheists to use my service, > but these attacks against me make me reconsider that. That would be illegal, as well as unethical. It would also demonstrate a total lack of understanding about the issue - there are plenty of homosexual Christians (as well as homosexuals of other religions), and a great many more Christians who are quite happy to let other people be their natural selves. Equally, there are plenty of atheists who are bigots about sexuality. You are free to have your own beliefs about religion or any other kind of superstition. You are also free to make your own choices about your sexuality (to the extent that it is under your concious control). You are /not/ free to impose them on other people, in any way. |
ram@zedat.fu-berlin.de (Stefan Ram): Nov 25 10:09AM IIRC, the C++ primer says that a converting constructor is a constructor that accepts exactly one argument. It says that constructors with more arguments can not possibly be considered for conversions, because a conversion situation only is given in the case of a single value. However, we all know 12.3.1p1 (now not from the primer, but from a recent draft of the standard): »A constructor declared without the function-specifier explicit specifies a conversion from the types of its parameters (if any) to the type of its class. Such a constructor is called a converting constructor.« . So, today's definition of »converting constructor« is not - one argument but - no "explicit". But after the C++ primer has so convincingly explained why a converting constructor is a constructor that accepts a single argument, why has the standard dropped this requirement? |
"Chris M. Thomasson" <invalid@invalid.invalid>: Nov 24 04:01PM -0800 On 11/22/2016 1:06 PM, Christopher J. Pisz wrote: > what new and delete normally do is going to save you. Maybe you have to > only use specific locations, but similar to the previous question, why > would that happen? Check this _Shi%_ out! Yikes, I see UB... FWIW, one can run the code: The origin of a Custom Allocator's base online here: http://cpp.sh/74po5 code: ___________________________________________________ #include <cstdio> #include <cstdlib> #include <cstddef> #include <cstdint> #include <cassert> #define MAX_ALIGN (alignof(std::max_align_t)) #define CACHE_LINE 128 #define SB_ALIGN 4096 #define SB_BYTES (SB_ALIGN - 128 - 1) static_assert(!(MAX_ALIGN & (MAX_ALIGN - 1)), "MAX_ALIGN Pow2 Error"); static_assert(!(CACHE_LINE & (CACHE_LINE - 1)), "Cache Line Pow2 Error"); static_assert(!(SB_ALIGN & (SB_ALIGN - 1)), "sblock Pow2 Error"); static_assert(!(CACHE_LINE % MAX_ALIGN), "Cache Line Alignment Error"); static_assert(!(SB_ALIGN % MAX_ALIGN), "sblock Alignment Error"); struct sblock_mem { unsigned char mem[SB_ALIGN]; }; struct sblock_desc { int a; }; static_assert(sizeof(sblock_desc) <= CACHE_LINE, "sblock_desc Size Error"); union sblock_desc_union { sblock_desc desc; unsigned char mem[CACHE_LINE]; }; struct sblock { sblock_desc_union descu; sblock_mem blks; }; #define ROUND_DOWN(mp_ptr, mp_align) \ (((unsigned char*)(mp_ptr)) - \ (((std::uintptr_t)(mp_ptr)) & (mp_align - 1))) #define ROUND_UP(mp_ptr, mp_align) \ (ROUND_DOWN(mp_ptr, mp_align) + (mp_align)) int main() { unsigned char lbuf[sizeof(sblock) + SB_ALIGN] = { '\0' }; unsigned char* abuf = ROUND_UP(lbuf, SB_ALIGN); sblock* sb = (sblock*)abuf; sb->descu.desc.a = 12345; unsigned char* sbp = (unsigned char*)sb; // 3967 is max offset because 4096-128 = 3968 unsigned char* mem = sb->blks.mem + 3967; unsigned char* rdmem = ROUND_DOWN(mem, SB_ALIGN); sblock* sbfinal = (sblock*)rdmem; assert(sbfinal == sb); std::printf("%lu\n", (unsigned long)sizeof(sblock)); std::printf("sbp:%p\n", (void*)sbp); std::printf("mem:%p\n", (void*)mem); std::printf("rdmem:%p\n", (void*)rdmem); std::printf("sbfinal:%p\n", (void*)sbfinal); std::printf("sbfinal->desc.a:%d\n", sbfinal->descu.desc.a); //std::fflush(stdout); //std::getchar(); return 0; } ___________________________________________________ The ROUND_* macros are making think HACKED SHI%. But, it does seem to work... Actually, IIRC, Intel TBB uses something very similar... |
"Chris M. Thomasson" <invalid@invalid.invalid>: Nov 24 04:14PM -0800 On 11/24/2016 4:01 PM, Chris M. Thomasson wrote: >> only use specific locations, but similar to the previous question, why >> would that happen? > Check this _Shi%_ out! Yikes, I see UB... Every time I posted this type of portion of my allocator code, I cringed at the ROUND_* macros. But, it does allow one to use a free function whose API just accepts a single void pointer. It rounds down to the base, and has access to the super block. I used this technique to build a multi-threaded allocator without using _any_ dynamic memory for a resource constrained application. Everything was allocated on the stack. A given number of threads could free allocations on other threads! :^) |
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