- Union type punning in C++ redux - 4 Updates
- I have posted just a few posts here, don't worry this is my last post in this newsgroup of C++ - 2 Updates
- "2020-02 Prague ISO C++ Committee Trip Report ??? C++20 is Done" - 1 Update
- Alignment hack... - 7 Updates
- transactional memory idea - 2 Updates
- You have to understand of what is to be stupid thinking.. - 3 Updates
- "Doing UTF-8 in Windows" by Mircea Neacsu - 1 Update
- Read again, i correct a typo because i write fast.. - 1 Update
- Sorry about my previous posts where i got angry - 1 Update
- So now that you know more about my personality - 1 Update
- Read again, i correct a last typo.. - 1 Update
- Before i stop writing in the newsgroups i will learn you more about me so that you understand me more.. - 1 Update
Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Feb 23 12:13AM -0500 Öö Tiib wrote: > to show that "I could not find in the Standard any additional guarantee > about reinterpret_cast results conditioned on the involved types' being > having standard-layout" does not matter since I could. I could not possibly "misinterpret the extent" of your example because my answer to your answer did not try to interpret its extent. All my answer to your answer said was: 1. That your answer pointed out one legal and potentially useful use of reinterpret_cast that I did not know before. 2. That your answer did not support your opinion of the legality of the latest code of the OP. Search bit more. Thank you, I did and still did not see anything that would help in proving that the reinterpret_casts used in the OP's last version of the code were legal. Did you? >> also empty) -- but that is not very useful as it is both shorter and IMHO more >> readable to just use static_cast for that). > Wrong place, red herring. ?? > That is what is fun about standard, there are additional guarantees about bytes (IOW chars) and also about that > std::aligned_storage. ;) There is nothing special I can see about std::aligned_storage with regard to reinterpret_cast. That said, I am always glad to learn from people who are know more than I do. ;) |
Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Feb 23 02:04AM -0500 Daniel wrote: > Hardly normative, but by my count, boost 1_71 has 4414 occurrences of > reinterpret_cast in 268 header files, including many uses with aligned > storage. We could discuss few specific ones that you believe are most common or useful and try to figure out whether they are legal C++ and, if not, how they can be fixed. As for your last example, the following seems to be a variant class that has same public API as yours but is IMHO legal C++ (I omitted the definitions of B and C as they did not need any changes): class V2 { union { B b; C c; }; public: V2(uint64_t n): b(n) { } V2(double d): c(d) { } ~V2() { switch (tag()) { case 1: b.~B(); break; case 2: c.~C(); break; default: break; } } uint8_t tag() const { return b.tag; } }; Above, it is legal to call access `b.tag' regardless of which of b or c is the active member of the union because `tag' is a part of common initial sequence of B and C as defined in 11.4-25 of the Standard. V2 also fulfills your requirement of having sizeof of 16 assuming 8-bytes alignment. |
Daniel <danielaparker@gmail.com>: Feb 23 07:43AM -0800 On Sunday, February 23, 2020 at 12:13:43 AM UTC-5, Pavel wrote: > > std::aligned_storage. ;) > There is nothing special I can see about std::aligned_storage with regard to > reinterpret_cast. Every use I've seen of std::aligned_storage has reinterpret_cast, without reinterpret_cast, what could you do with it? For instance, the example in cppreference, template<class T, std::size_t N> class static_vector { // properly aligned uninitialized storage for N T's typename std::aligned_storage<sizeof(T), alignof(T)>::type data[N]; std::size_t m_size = 0; public: // Create an object in aligned storage template<typename ...Args> void emplace_back(Args&&... args) { if( m_size >= N ) // possible error handling throw std::bad_alloc{}; // construct value in memory of aligned storage // using inplace operator new new(&data[m_size]) T(std::forward<Args>(args)...); ++m_size; } // Access an object in aligned storage const T& operator[](std::size_t pos) const { // note: needs std::launder as of C++17 return *reinterpret_cast<const T*>(&data[pos]); } // Delete objects from aligned storage ~static_vector() { for(std::size_t pos = 0; pos < m_size; ++pos) { // note: needs std::launder as of C++17 reinterpret_cast<T*>(&data[pos])->~T(); } } }; I note the comment in the destructor, "needs std::launder as of C++17", which I wasn't previously aware of. Daniel |
Daniel <danielaparker@gmail.com>: Feb 23 07:46AM -0800 On Sunday, February 23, 2020 at 2:04:15 AM UTC-5, Pavel wrote: > sequence of B and C as defined in 11.4-25 of the Standard. > V2 also fulfills your requirement of having sizeof of 16 assuming 8-bytes > alignment. That would do, thanks, Daniel |
guinness.tony@gmail.com: Feb 23 06:10AM -0800 > Hello, > I have posted just a few posts here, don't worry this is my last post in this newsgroup of C++ 10 is not "just a few". |
Bonita Montero <Bonita.Montero@gmail.com>: Feb 23 03:50PM +0100 > Hello, > I have posted just a few posts here, don't worry this is my last post in this newsgroup of C++ Go to a doctor. You're bipolar and you don't have control over yourself. |
Juha Nieminen <nospam@thanks.invalid>: Feb 23 02:08PM > I wonder what happened to Stroustrup's request to slow down the > development? No major developments have been made since C++11. Both C++14 and C++17 were relatively minor updates. How much more slow does it need to be? If no major updates are done in 9 years, and that's *still* too fast, then what is the proper timescale in that case? 20 years? 50 years? What? |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 22 05:01PM -0800 On 2/21/2020 3:50 AM, Alf P. Steinbach wrote: >> portable way. When I say a large boundary, I mean say, 2048 bytes are >> much bigger. Well, here is some code, can you even get it to run >> without tripping an assert or getting a throw? [...] >> many fun things we can do here, but I am afraid it all UB. ;^o > Not sure, I just cooked this up, but I believe the following is > standard-compliant and does what you want: [...] Okay, will have some more time tonight to look at your code. Btw, the reason I want to forcefully align objects on large boundaries is for performance reasons wrt exotic algorithms. We can steal bits from highly aligned addresses, and/or we can round a point down to the lowest large boundary to get at meta data for a high performance allocator. |
"Öö Tiib" <ootiib@hot.ee>: Feb 22 08:13PM -0800 On Sunday, 23 February 2020 03:02:03 UTC+2, Chris M. Thomasson wrote: > performance reasons wrt exotic algorithms. We can steal bits from highly > aligned addresses, and/or we can round a point down to the lowest large > boundary to get at meta data for a high performance allocator. I sometimes feel that we are going too far with our pursuit of performance. Quality is always more important. My discussions with end users have always revealed that they see it absurd when shop adds features or performance instead of fixing known bugs. No one cares how fast they get wrong answers. And that is obvious ... no one, zero, zip, zilch, nada. I may be am unjust here but to me it feels far more trickier to achieve quality (than performance) with C++. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 22 08:32PM -0800 On 2/22/2020 8:13 PM, Öö Tiib wrote: > obvious ... no one, zero, zip, zilch, nada. > I may be am unjust here but to me it feels far more trickier to > achieve quality (than performance) with C++. A fun part can be allowing an allocators free operation to take an address, round it down to the lowest large boundary, say we align on a 8192 boundary. then, the result of the rounding down directly gets at the meta data for its master block, so to speak. Easy, simple and efficient... However. its embracing dr. hackinstein! This master block can have a lifo list that the freed block of memory can use for a cache. Man, the last time I worked on this was way back in early mid 2000's ish. Fwiw, working on an animation right now, should have some more time tonight. Fwiw, here is my current work. https://youtu.be/xbm4r45S2Xs |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 22 08:37PM -0800 On 2/22/2020 8:13 PM, Öö Tiib wrote: >> boundary to get at meta data for a high performance allocator. > I sometimes feel that we are going too far with our pursuit of > performance. Well, wrt this alignment hack, it can help create things that _need_ high performance, like an allocator. Quality is always more important. My discussions |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 22 08:40PM -0800 On 2/21/2020 3:50 AM, Alf P. Steinbach wrote: >> many fun things we can do here, but I am afraid it all UB. ;^o > Not sure, I just cooked this up, but I believe the following is > standard-compliant and does what you want: [...] Thank you for pointing my C mind to: https://en.cppreference.com/w/cpp/memory/align Never used it. It should work fine. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 22 08:41PM -0800 On 2/22/2020 8:40 PM, Chris M. Thomasson wrote: >>> Fwiw, this is some old C code I just cobbled up to work with C++; >>> used it as a region allocator in the past: >>> https://groups.google.com/forum/#!original/comp.lang.c/7oaJFWKVCTw/sSWYU9BUS_QJ [...] > Thank you for pointing my C mind to: > https://en.cppreference.com/w/cpp/memory/align > Never used it. It should work fine. Need to snip better. Sorry. |
Melzzzzz <Melzzzzz@zzzzz.com>: Feb 23 01:26PM > obvious ... no one, zero, zip, zilch, nada. > I may be am unjust here but to me it feels far more trickier to > achieve quality (than performance) with C++. I worry about performance only if circumstances require. This is not Python. -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo>: Feb 23 12:20AM -0500 Bonita Montero wrote: >> non-occasional use and a couple of change requests ensuing from it, possibly >> performed by others acting on similar "tastes". > You're stupid. :-) > No one has problems to understand such a tiny code-snippet. You posted more than one; which one are you talking about now? |
Bonita Montero <Bonita.Montero@gmail.com>: Feb 23 10:09AM +0100 >> No one has problems to understand such a tiny code-snippet. > You posted more than one; which one are you talking about now? That's all simple code. |
aminer68@gmail.com: Feb 22 03:27PM -0800 Hello, You have to understand of what is to be stupid thinking.. You are thinking that i am posting here on C++ newsgroup, but you are stupidly thinking, because i have just decided to post very few posts and after that i am stopping posting here, and you have to be aware that in reality i don't want to post here in the C++ newsgroup, it is the same for the newsgroup of comp.programming, you have to realize that i have noticed many years before that usenet was dying and comp.programming and such newsgroups were dying , so i have decided to post some posts of mine in comp.programming and such to keep those newsgroupssuch as comp.programming alive, so you are stupidly thinking that i am like spamming, but you are not thinking correctly, because i am not interested in usenet, and i am not interested in talking to you, because usenet is dying, so don't waste your time with me by reporting me as spamming or something like that. Thank you, Amine Moulay Ramdane. |
David Brown <david.brown@hesbynett.no>: Feb 23 07:11AM +0100 > because i am not interested in usenet, and i am not interested in > talking to you, because usenet is dying, so don't waste your time > with me by reporting me as spamming or something like that. You think Usenet is dying and you keep it alive with your posts? You poor, misguided fool. comp.programming died /because/ of your posts. Groups like c.l.c++ are very much alive - and the reason people want to get you blocked is so that you don't kill it too! Find some political or poetry group where your posts are on-topic. Start a blog. Move to Facebook. Find some where /appropriate/ for your ramblings, and take them away from here. |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Feb 22 10:42PM -0800 > On 23/02/2020 00:27, aminer68@gmail.com wrote: >> You have to understand of what is to be stupid thinking.. [snip] > You think Usenet is dying and you keep it alive with your posts? You > poor, misguided fool. [...] David, I never see this person's posts unless someone like you insists on quoting them. Please stop bypassing my filters. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */ |
"Öö Tiib" <ootiib@hot.ee>: Feb 22 07:53PM -0800 On Sunday, 23 February 2020 01:22:32 UTC+2, Thiago Adams wrote: > SetConsoleOutputCP(CP_UTF8); > printf(u8"maçã"); > SetConsoleOutputCP(oldcp); Thanks, I'll try when I get something windows ... possibly Monday. ;) |
Wisdom90 <d@d.d>: Feb 22 09:35PM -0500 Hello, Read again, i correct a typo because i write fast.. Sorry about my previous posts where i got angry, it is because we can get angry in this violent world, but don't bother because i am a gentleman and i am like a wise man, so you have to know that i will stop to post in the programming newsgroups like C++ and comp.programming and comp.programming.threads and ADA , but i will continu to expose my political philosophy in the other newsgroups like soc.culture.usa or soc.culture.quebec or alt.culture.morocco, i am like wise type of person and i like very much to write my thoughts of my political philosophy and i like to write beautiful poems of Love, so if you want to read about my thoughts of my political philosophy or about my poems of Love, you can read soc.culture.usa or soc.culture.quebec or alt.culture.morocco because i will post there. So now that you know more about my personality, so this is my last post here in this newsgroup. Thank you, Amine Moulay Ramdane. |
aminer68@gmail.com: Feb 22 06:27PM -0800 Hello, Sorry about my previous posts where i got angry, it is because we can angry in this violent world, but don't bother because i am a gentleman and i am like a wise man, so you have to know that i will stop to post in the programming newsgroups like C++ and comp.programming and comp.threads.programming and ADA , but i will continu to expose my political philosophy in the other newsgroups like soc.culture.usa or soc.culture.quebec or alt.culture.morocco, i am like wise type of person and i like very much to write my thoughts of my political philosophy and i like to write beautiful poems of Love, so if you want to read about my thoughts of my political philosophy or about my poems of Love, you can read soc.culture.usa or soc.culture.quebec or alt.culture.morocco because i will post there. So now that you know more about my personality, so this is my last post here in this newsgroup. Thank you, Amine Moulay Ramdane. |
Wisdom90 <d@d.d>: Feb 22 07:45PM -0500 Hello, So now that you know more about my personality, so this is my last post here in this newsgroups on usenet. Thank you, Amine Moulay Ramdane. |
Wisdom90 <d@d.d>: Feb 22 07:32PM -0500 Hello, Read again, i correct a last typo.. Before i stop writing in the newsgroups i will learn you more about me so that you understand me more.. I think that this Bonita Montero and this Chad of comp.programming are not understanding my personality, i am like a much more virile person and it is like i don't accept that people to learn me, so i have to be in accordance with my much more virility, so i have to learn myself and to teach myself alone without the help of others, and i have to invent many scalable algorithms alone without the help of others, i am much virile so i have to show that i am more capable than the others, also i am much more virile and i hate to talk to people here, because i view them as mentally handicaped and inferior, so i don't want to waste my time with people like you that are handicaped and inferior, so this is why you have to understand me more, and i will learn you more about me, you have seen me posting in comp.programming and comp.programming.threads and you have to know why i was posting there, it is simply because i have noticed many years ago that usenet was dying and the newsgroups such as comp.programming and comp.programming.threads were dying , so i have decided to organize it and to post there like i was posting, but since i have just noticed that some of you want to report me as spam, so i have decided to stop posting in this newsgroups. This is why i said: To the ones that want to report me like spam, you have to know me more, i am not interested in usenet, i am not interested in talking to persons in this newsgroup, so if you know me more like i am learning you to know me, you will know that you have not to waste your time with me, and what do you think is this "shit" of usenet ? usenet is not interesting at all, so you have to believe me that i am not interested in usenet , this is why i am stopping to post here in C++ newsgroup, so you are wasting your time. Thank you, Amine Moulay Ramdane. |
Wisdom90 <d@d.d>: Feb 22 07:28PM -0500 Hello, Before i stop writing in the newsgroups i will learn you more about me so that you understand me more.. I think that this Bonita Montero and this Chad of comp.programming are not understanding my personality, i am like a much more virile person and it is like i don't accept that people to learn me, so i have to be in accordance with my much more virility, so i have to learn myself to teach myself alone without the help of others, and i have to invent many scalable algorithms alone without the help of others, i am much virile so i have to show that i am more capable than the others, also i am much more virile and i hate to talk to people here, because i view them as mentally handicaped and inferior, so i don't want to waste my time with people like you that are handicaped and inferior, so this is why you have to understand me more, and i will learn you more about me, you have seen me posting in comp.programming and comp.programming.threads and you have to know why i was posting there, it is simply because i have noticed many years ago that usenet was dying and the newsgroups such as comp.programming and comp.programming.threads were dying , so i have decided to organize it and to post there like i was posting, but since i have just noticed that some of you want to report me as spam, so i have decided to stop posting in this newsgroups. This is why i said: To the ones that want to report me like spam, you have to know me more, i am not interested in usenet, i am not interested in talking to persons in this newsgroup, so if you know me more like i am learning you to know me, you will know that you have not to waste your time with me, and what do you think is this "shit" of usenet ? usenet is not interesting at all, so you have to believe me that i am not interested in usenet , this is why i am stopping to post here in C++ newsgroup, so you are wasting your time. Thank you, Amine Moulay Ramdane. |
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