- Niuce C++14-feature - 23 Updates
- Why does this work in MSVC 2019... - 2 Updates
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 12:53AM -0700 > I'm curious as to why you think someone criticising an aspect of C++ > is trolling. If this forum is merely to praise how wonderful the language > is to its acolytes then what purpose does it serve? All criticisms are welcome. I can say, back when C/C++11 first came out, why was there not an eventcount or futex like thread sync mechanism? Well, shit happens. The fun part is that they can be coded up in pure C/C++11. Not ideal, but they can be coded. Then the response can be nice, or evil... The response can be to tell me to go snuff myself. That is a "troll'ish" response, well, imvvho, that is. |
| MrSpook_ox7@4ieqo8ddusd3k1c8k.com: May 19 08:22AM On Wed, 19 May 2021 09:41:07 +0200 >>> so you're lying. >> Why would I lie about something like that? ... >Because we all know you're an asshole. I'm wondering you're a Juha sock puppet. You and him sound pretty similar. >> It caused the compiler to crash, thats a fact. >No, you don't. It can be excluded that the 0 is parsed >as a number and not as a token of the grammar. How the hell would you know how its being parsed? I doubt you've ever used Solaris in your life but if you did you'd know that Suns earlier C++ compilers could be rather flaky. This was just one example. >You're simply a liar. You're just a sore loser. You lost the previous argument and now you're throwing your toys out the pram like a little baby. Grow up, get over it and move on. |
| MrSpook_pl1c1bg7i@7sxv4z8mvmyz_.ac.uk: May 19 08:28AM On Wed, 19 May 2021 00:53:41 -0700 >why was there not an eventcount or futex like thread sync mechanism? >Well, shit happens. The fun part is that they can be coded up in pure >C/C++11. Not ideal, but they can be coded. Presumably the same reason they're not part of the C language - C++ is a cross platform language and some realtime kernel don't support futex's. Arguably even having built in threading support in C++ is a step too far. After all, if it has threading why doesn't it have built in multi process support too? |
| Bonita Montero <Bonita.Montero@gmail.com>: May 19 10:28AM +0200 > How the hell would you know how its being parsed? ... No one who is able to write something complex like a C++-compiler would make such a beginners-failure and implement the language-tokens wrong. > I doubt you've ever used Solaris in your life but if you did you'd > know that Suns earlier C++ compilers could be rather flaky. This > was just one example. Many uncommon compilers implement the standard not as correctly as gcc, clang and MSVC, but such a basic beginner's failure is extremely unlikely. As you've been trolling here for a while it's likely that you're also a liar. |
| Bonita Montero <Bonita.Montero@gmail.com>: May 19 10:30AM +0200 > All criticisms are welcome. I can say, back when C/C++11 first came out, > why was there not an eventcount or futex like thread sync mechanism? These are facilities which aren't supplied by every operating-system but could be used to implement the synchronization-facilities C++11 provides. > Well, shit happens. The fun part is that they can be coded up in pure > C/C++11. Not ideal, but they can be coded. No, futexes need explicit kernel-support. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:34AM -0700 >> C/C++11. Not ideal, but they can be coded. > Presumably the same reason they're not part of the C language - C++ is a > cross platform language and some realtime kernel don't support futex's. Right. However, we can emulate an eventcount or futex in C++. > Arguably even having built in threading support in C++ is a step too far. Why? > After all, if it has threading why doesn't it have built in multi process > support too? Humm... |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:35AM -0700 On 5/19/2021 1:30 AM, Bonita Montero wrote: >> Well, shit happens. The fun part is that they can be coded up in pure >> C/C++11. Not ideal, but they can be coded. > No, futexes need explicit kernel-support. Wel, true futex does, but it can be emulated. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:36AM -0700 On 5/19/2021 1:35 AM, Chris M. Thomasson wrote: >>> C/C++11. Not ideal, but they can be coded. >> No, futexes need explicit kernel-support. > Wel, true futex does, but it can be emulated. think about it for a moment. How would you create an eventcount or futex using pure C++11? |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:37AM -0700 On 5/19/2021 1:36 AM, Chris M. Thomasson wrote: >> Wel, true futex does, but it can be emulated. > think about it for a moment. How would you create an eventcount or futex > using pure C++11? It can be done: https://youtu.be/1G13KzEJqBw ;^) Also, here is some code for an eventcount: Read all: https://groups.google.com/g/lock-free/c/acjQ3-89abE/m/dbNokvg-nRIJ |
| MrSpook_4t1542s@nz48t.gov: May 19 08:40AM On Wed, 19 May 2021 10:28:48 +0200 >No one who is able to write something complex like a C++-compiler >would make such a beginners-failure and implement the language-tokens >wrong. Well they did. >Many uncommon compilers implement the standard not as correctly as >gcc, clang and MSVC, but such a basic beginner's failure is extremely >unlikely. Oh right. You're an expert in compiler design are you? You have no idea how they implemented it. >As you've been trolling here for a while it's likely that you're >also a liar. Well I'm not lying, it was a bug. You are a jackass however. |
| MrSpook_6efnqt73nm@nyyte.com: May 19 08:44AM On Wed, 19 May 2021 01:34:15 -0700 >> Presumably the same reason they're not part of the C language - C++ is a >> cross platform language and some realtime kernel don't support futex's. >Right. However, we can emulate an eventcount or futex in C++. You can't emulate OS level locking in a higher level context. >> Arguably even having built in threading support in C++ is a step too far. >Why? Because some systems don't even support threads - eg PIC. >> After all, if it has threading why doesn't it have built in multi process >> support too? >Humm... Humm indeed. I suspect its because the win32 process model is profoundly broken and since Windows dev was/is arguably the largest user base for C++ they didn't see the point. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:50AM -0700 >>> cross platform language and some realtime kernel don't support futex's. >> Right. However, we can emulate an eventcount or futex in C++. > You can't emulate OS level locking in a higher level context. Why not? I can emulate an eventcount, a futex is not that far off and can be emulated as well. in C++11. >>> Arguably even having built in threading support in C++ is a step too far. >> Why? > Because some systems don't even support threads - eg PIC. That's fine. Why is that a problem? Does it support C++11? If so, the code shall run. > Humm indeed. I suspect its because the win32 process model is profoundly > broken and since Windows dev was/is arguably the largest user base for C++ > they didn't see the point. Windows has nothing to do with it. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:53AM -0700 > Humm indeed. I suspect its because the win32 process model is profoundly > broken and since Windows dev was/is arguably the largest user base for C++ > they didn't see the point. We can even go lower and emulate a waitset as a linked list of condvars with pure C++11. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 01:54AM -0700 On 5/19/2021 1:53 AM, Chris M. Thomasson wrote: >> they didn't see the point. > We can even go lower and emulate a waitset as a linked list of condvars > with pure C++11. It would need to result in SCHED_OTHER, but okay, for the emulation. |
| David Brown <david.brown@hesbynett.no>: May 19 11:16AM +0200 >> was indeed a thing at all. > I remember that anything other than zero would crash a number of older versions > of the solaris compiler back in 00s. A virtual function is syntactic sugar for a function pointer (in a table). The syntax " = 0" for a pure virtual function is then obvious - it is initialising the function pointer to a null pointer. The compiler can then generate code to use the virtual function pointer "vfp_foo" as : if (vfp_foo) { vfp_foo(); } else { ... call terminate ... } If you have initialised the virtual function pointer to a value that is not 0, and not a valid function, anything might happen - including a crash. A compiler with helpful warnings will tell you something is wrong when you try to initialise it with something other than 0, but perhaps an early version would assume that no one is silly enough to do that, and just re-use existing initialisation handling to give the programmer exactly the nonsense they asked for. |
| MrSpook_V1@aikd06tg1ez2i6hqi9.com: May 19 09:29AM On Wed, 19 May 2021 11:16:29 +0200 >perhaps an early version would assume that no one is silly enough to do >that, and just re-use existing initialisation handling to give the >programmer exactly the nonsense they asked for. All true, but I'm not talking about a program crash, I'm talking about an actual compiler crash when it encountered " = 1;". |
| MrSpook_54rouunX@x37ixhgx27ymvhwc5.net: May 19 09:31AM On Wed, 19 May 2021 01:50:32 -0700 >> You can't emulate OS level locking in a higher level context. >Why not? I can emulate an eventcount, a futex is not that far off and >can be emulated as well. in C++11. Oh ok. So explain how you'd implement an atomic futex in userspace that say was used to implement a semaphore that other processes would use. >> Because some systems don't even support threads - eg PIC. >That's fine. Why is that a problem? Does it support C++11? If so, the >code shall run. No, it wouldn't. Real time compilers often only support a subset of a language whether it be C or C++. >> broken and since Windows dev was/is arguably the largest user base for C++ >> they didn't see the point. >Windows has nothing to do with it. What is the reason then? |
| Paavo Helde <myfirstname@osa.pri.ee>: May 19 01:36PM +0300 > All true, but I'm not talking about a program crash, I'm talking about > an actual compiler crash when it encountered " = 1;". So there was a buggy compiler a long time ago which crashed on 'virtual foo()=1;'. What makes you think it would not have crashed on encountering 'virtual pyre foo();' if 'virtual pure foo();' were a standardized syntax? A compiler can have bugs everywhere. For not adding a new keyword like 'pure' in the language there was a single reason only: to avoid conflicts with the existing C code which might have had used this word. They wanted to keep the number of new keywords at absolute minimum. The ease of writing the compilers was never a concern (cf 'export'). |
| Bonita Montero <Bonita.Montero@gmail.com>: May 19 12:54PM +0200 >> would make such a beginners-failure and implement the language-tokens >> wrong. > Well they did. As you already proved you're an asshole it's also very likely you're a liar. Even more as this bug is very unlikely. |
| Bonita Montero <Bonita.Montero@gmail.com>: May 19 12:56PM +0200 > So there was a buggy compiler a long time ago which crashed on > 'virtual foo()=1;'. ... There has never been such compiler. MrSpook should prove this - this must be documented, the web doesn't forget anything. |
| Bonita Montero <Bonita.Montero@gmail.com>: May 19 12:57PM +0200 >>> C/C++11. Not ideal, but they can be coded. >> No, futexes need explicit kernel-support. > Wel, true futex does, but it can be emulated. No one needs pure futexes - they're used to build other synchronization -facilities on top of them. Some of them are those you have in mind wich could be used to emulate a futex. |
| MrSpook_w5c@g2nz1m_2f4r2g8wqvgfd.co.uk: May 19 11:07AM On Wed, 19 May 2021 13:36:18 +0300 >So there was a buggy compiler a long time ago which crashed on 'virtual >foo()=1;'. What makes you think it would not have crashed on >encountering 'virtual pyre foo();' if 'virtual pure foo();' were a It may well have done. >standardized syntax? A compiler can have bugs everywhere. Well they are one of the most complex pieces of software around so it would be amazing if they didn't. >For not adding a new keyword like 'pure' in the language there was a >single reason only: to avoid conflicts with the existing C code which >might have had used this word. They wanted to keep the number of new Plenty of C code probably used virtual, new, delete etc as function or variable names too even though some combination of punctuation characters would have done the job too. So why suddenly use "= 0" instead of "pure"? |
| MrSpook_2ur@t65zb.com: May 19 11:08AM On Wed, 19 May 2021 12:54:24 +0200 >> Well they did. >As you already proved you're an asshole it's also very likely you're >a liar. Even more as this bug is very unlikely. Thanks for your input sock puppet. Just because you can't find it in google doesn't mean it doesn't exist. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 12:45AM -0700 On 5/18/2021 11:50 PM, Paavo Helde wrote: > The only reason this is a warning and not an error is because UB > formally only appears when dereferencing the invalid pointer/reference, > returning it from a function is actually fine. 100% agreed! I saw the warnings, but was interested into why the program was allowed to run to completion under MSVC. Then I tried it GCC, different things occurred. Its the nature of the beast wrt UB. I thank you and everybody else for their time and patience. |
| "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: May 19 12:46AM -0700 On 5/18/2021 10:02 PM, Bonita Montero wrote: >> on MSVC, however it will not even run on GCC without a segfault. > It's implementation-defined how long the memory of the temporary is > untouched. This is pretty much exactly what is occurring. Thanks Bonita, and thanks again for the heads up on is_transparent! |
| 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