- Multi-compare operators - 10 Updates
- The C++ pronunciation dictionary, version 1.0 - 3 Updates
- Conservative employees "don't feel safe" - 9 Updates
- Signed unsigned mismatch? - 1 Update
- "My CppCon 2018 talk title and abstract" 2018-09-14 by Herb Sutter - 1 Update
- Idea for allowing "using namespace" in headers - 1 Update
bitrex <user@example.net>: Sep 19 07:47PM -0400 On 09/19/2018 05:23 PM, David Brown wrote: > There is nothing wrong with the idea of making expressions like these > match their mathematical meaning. But it would be confusing to do so in > a C-like language. Yes, I meant "ambiguous" in the sense of my brain might not have been able to immediately intuit what behavior that form of expression invoked. Given that it compiled and it does not appear to invoke any undefined behavior I know of then surely the compiler is not confused. It will do something, whatever it is. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Sep 20 02:50AM +0200 On 19.09.2018 18:23, Scott wrote: > What nonsense are you trolling about now? Everybody knows that these > are already perfectly valid constructs in C with simple and > unambiguous semantics. That's beside the point. Python provides the mathematical meaning, so it's quite doable. It's not there in C++ because the developers of original C were figuring out the syntax and semantics as they went. E.g. the notation for boolean operations changed on the way. The first set of choices that worked reasonably well, that was Good Enough, stuck, a case of frozen history. Cheers & hth., - Alf |
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 19 09:51PM -0400 On 09/19/2018 07:47 PM, bitrex wrote: >>> On 09/19/2018 12:23 PM, Scott wrote: >>>> On Wed, 19 Sep 2018 11:01:45 -0400, "Rick C. Hodgin" >>>> <rick.c.hodgin@gmail.com> wrote: ... >>>>> if (a < b < c < d < e) ... > invoked. Given that it compiled and it does not appear to invoke any > undefined behavior I know of then surely the compiler is not confused. > It will do something, whatever it is. In C, the comparison operators return 1 if the comparison is true, and 0 if it is false. Keeping that in mind, the above code is equivalent to int i = a < b; int j = i < c; int k = j < d; if(k < e) ... Does that help? |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Sep 20 04:15AM +0100 >>> language with these features: >>> if (a <= b < c) >>> printf("b is [a, c)\n"); <snip> > for boolean operations changed on the way. The first set of choices > that worked reasonably well, that was Good Enough, stuck, a case of > frozen history. Sure, but there's a bit more to it than that. C cites B and BCPL as inspiration and BCPL has relational operators that chain like this (as does its more modern incarnation, MCPL). They could have been in C (and therefore probably in C++) but they missed the cut. -- Ben. |
"Öö Tiib" <ootiib@hot.ee>: Sep 19 09:11PM -0700 On Thursday, 20 September 2018 00:24:07 UTC+3, David Brown wrote: > There is nothing wrong with the idea of making expressions like these > match their mathematical meaning. But it would be confusing to do so in > a C-like language. In C++ we can make something like M(a) < M(b) < M(c) < M(d) to have mathematical meaning of a < b < c < d by overloading operator< of M. |
Christian Gollwitzer <auriocus@gmx.de>: Sep 20 07:17AM +0200 Am 20.09.18 um 06:11 schrieb Öö Tiib: > In C++ we can make something like M(a) < M(b) < M(c) < M(d) to > have mathematical meaning of a < b < c < d by overloading operator< > of M. How would you do that? It seems quite complicated to me, because the expression is still parsed as ((a < b) < c). Would you return a proxy object from the comparison which decays to bool? Then probably you would need to store "b" in this proxy in order to compare with "c". Christian |
David Brown <david.brown@hesbynett.no>: Sep 20 08:21AM +0200 On 20/09/18 01:47, bitrex wrote: > invoked. Given that it compiled and it does not appear to invoke any > undefined behavior I know of then surely the compiler is not confused. > It will do something, whatever it is. Ah, you mean /your/ interpretation of it is ambiguous - not that the C itself is ambiguous. Yes, I can appreciate that. There is nothing for it but to learn the way C interprets this type of expression - and then, like all sane C programmers, avoid writing it. |
bitrex <user@example.net>: Sep 20 02:41AM -0400 On 09/19/2018 11:01 AM, Rick C. Hodgin wrote: > if (a < b < c < d < e) > prinf("b is (a, c)\nc is (b, d)\nd is (c, e)\n"); > Et cetera... Each evaluated left-to-right. you can do a three-way compare in one line without using the && operator like: bool three(unsigned char a, unsigned char b, unsigned char c) { return (a < (b < c ? b : false)); } four way: bool four_way(unsigned char a, unsigned char b, unsigned char c, unsigned char d) return (a < (b < (c < d ? c : false) ? b : false)); } clang-trunk output of the above, -std=c++11 -O1 cmp dl, cl jb .LBB0_2 xor edx, edx .LBB0_2: cmp dl, sil ja .LBB0_4 xor esi, esi .LBB0_4: cmp sil, dil seta al ret vs: bool four_way_using_and(unsigned char a, unsigned char b, unsigned char c, unsigned char d) { return (a < b && b < c && c < d); } output: cmp dil, sil setb al cmp sil, dl setb sil and sil, al cmp dl, cl setb al and al, sil ret Which using C++1x syntax maybe suggests some kind of template/variadic recursive-stuff approach for generating implementation for arbitrary number of arguments of arbitrary type (not tested...) template <typename T> auto base(T a) -> decltype(a) { return a; } template <typename T> auto two(T a, T b) -> decltype(base(base(a) < base(b) ? base(a) : false)) { return base(base(a) < base(b) ? base(a) : false); } template <typename T> auto three(T a, T b, T c) -> decltype(base(base(a) < two(base(b), base(c)))) { return base(base(a) < two(base(b), base(c))); } etc...?? |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Sep 20 10:38AM +0200 On 20.09.2018 07:17, Christian Gollwitzer wrote: > expression is still parsed as ((a < b) < c). > Would you return a proxy object from the comparison which decays to > bool? Yes. > Then probably you would need to store "b" in this proxy in order > to compare with "c". Yes. But it's IMHO ugly, but code-wise and in resulting notation: namespace tag { struct Math{}; constexpr auto math = Math(); } template< class Arg > class Comparison_result { Arg m_arg; bool m_result; public: auto result() const -> bool { return m_result; } explicit operator bool() { return m_result; } template< class Rhs > friend auto operator<( const Comparison_result lhs, const Rhs rhs ) -> Comparison_result<Rhs> { return Comparison_result<Rhs>( rhs, lhs.m_result and lhs.m_arg < rhs ); } Comparison_result( const Arg value, const bool result = true ): m_arg( value ), m_result( result ) {} }; template< class Rhs > auto operator>>( tag::Math, const Rhs value ) -> Comparison_result<Rhs> { return Comparison_result<Rhs>( value ); } #include <iostream> using namespace std; auto main() -> int { double const x = 3.14; cout << boolalpha; cout << "In 1...7? " << !!(tag::math>> 1 < x < 7) << endl; cout << "In 4...7? " << !!(tag::math>> 4 < x < 7) << endl; } Cheers!, - Alf |
"Öö Tiib" <ootiib@hot.ee>: Sep 20 01:43AM -0700 On Thursday, 20 September 2018 08:17:45 UTC+3, Christian Gollwitzer wrote: > Would you return a proxy object from the comparison which decays to > bool? Then probably you would need to store "b" in this proxy in order > to compare with "c". Yes. For example M < M returns M::R and M::R < M returns also M::R and only that M::R has conversion to bool. What can't be done in C++ is short-circuiting that a < b && b < c has. To achieve LISP-like lazy evaluation effects we have to use inelegant constructs in C++. |
David Brown <david.brown@hesbynett.no>: Sep 20 08:13AM +0200 On 19/09/18 23:35, Real Troll wrote: >> wouldn't let us call it Java". >>> /Jorgen > How about Delphi? Pronounced as: DelfiI or Delfy "Delfy" would be closest. But I would say pronounce it as "Delphi" - it's a place name. |
Christian Gollwitzer <auriocus@gmx.de>: Sep 20 09:40AM +0200 Am 15.09.18 um 22:55 schrieb Stefan Ram: > the IPA pronunciation notation and can see most Unicode 5.0 > characters in their newsreader. The American English > pronunciations are given. I'm most surprised about this one: > deque dɛk I've always pronounced it like 'diːkjuː, because it is a double ended queue (ˈkjuː) which coincides up to the accent with the verb dequeue (diːˈkjuː according to the OED) Christian |
Christian Gollwitzer <auriocus@gmx.de>: Sep 20 09:43AM +0200 Am 19.09.18 um 17:15 schrieb David Brown: > gather Americans sometimes pronounce the name with "i" like in "eye", > but I would say the "correct" pronunciation of the name Linus, and thus > Linux, should follow the Finnish version. There is a pronunciation guide from Linus himself: https://www.youtube.com/watch?v=c39QPDTDdXU which I hear as ['Li:nuks], which is the same it is usually pronounced over here in Germany. Christian |
bitrex <user@example.net>: Sep 19 06:41PM -0400 On 09/19/2018 01:35 PM, Rick C. Hodgin wrote: > could not haul it in. > It's not up to us to convert people. That's the work of God's Holy > Spirit on the inside of people. It is up to us to teach. Much later in life when I read the words in the Gospel they had a different meaning, there are words that Christ said which expressed succinctly things I had fumbled around in the dark for years to express, based on my own life experience. And there it all was in one or two sentences. But Christ was barely 30 when he began his ministry, not much more than a child. how could he have known these things. When I read it from that perspective I found myself thinking "But that's impossible." There are math prodigies, physics prodigies, software prodigies, all sorts of stuff like that which doesn't strain credibility. The Gospels are something else entirely. It's impossible, but there it is. |
bitrex <user@example.net>: Sep 19 06:45PM -0400 On 09/19/2018 06:41 PM, bitrex wrote: > There are math prodigies, physics prodigies, software prodigies, all > sorts of stuff like that which doesn't strain credibility. The Gospels > are something else entirely. It's impossible, but there it is. And no, I do not believe myself to be crazy. I don't feel crazy, at least. :) |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Sep 19 03:55PM -0700 On 9/19/2018 3:45 PM, bitrex wrote: >> are something else entirely. It's impossible, but there it is. > And no, I do not believe myself to be crazy. I don't feel crazy, at > least. :) That made me laugh. ;^) |
bitrex <user@example.net>: Sep 19 07:07PM -0400 On 09/19/2018 06:55 PM, Chris M. Thomasson wrote: >> And no, I do not believe myself to be crazy. I don't feel crazy, at >> least. :) > That made me laugh. ;^) At the very least I understand why it's a popular book - Jesus says very few "throwaway" lines or if had been a comedian would have never told a dud joke. You have to think about 'em to "get it" sometimes but if and when you do it's a megaton knowledge-bomb, a Barry Bonds home run out of the park. Yeah could be a forgery but like, it'd be the equivalent of someone writing a forged Seinfeld joke book claiming it was by Jerry Seinfeld but the jokes were a hundred times better. Why then claim they were by someone else when you could just go be the greatest comedian ever yourself instead? ??????? |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Sep 19 07:09PM -0400 On 9/19/2018 5:27 PM, Chris M. Thomasson wrote: > enter the eternal Heaven, for God forgave them because they are a really nice > individual, and fun to talk to. Would you try to disagree with God? > Just wondering Rick. Sin, not just homosexuality, is not tolerated by God. All sin will be completely and totally punished. He will not forgive any sin, save through Jesus Christ, whom He punishes in our place. Jesus literally gets the punishment we deserve poured out on Him. He did this voluntarily because He wants to save us from our folly. The Bible gives two positions: some people God saves by His own volition, drawing them from within for His own purposes. Others He draws to His Son after examining their heart and core and see- ing their pursuits and actions, which relates to the "whosoever will" group invited by Jesus to come to Him and be saved in scripture. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 20 12:15AM +0100 On 20/09/2018 00:09, Rick C. Hodgin wrote: > ing their pursuits and actions, which relates to the "whosoever > will" group invited by Jesus to come to Him and be saved in > scripture. And Satan invented fossils yes? Take your medication mate. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Sep 19 11:08PM -0700 On 9/19/2018 4:07 PM, bitrex wrote: > but the jokes were a hundred times better. Why then claim they were by > someone else when you could just go be the greatest comedian ever > yourself instead? ??????? One time, after a while of waiting for a rendering to complete, and finally being able to observe the results... Well, I was amazed, and thought I saw some sort of holographic blue print for part of a damn alien being: http://siggrapharts.ning.com/photo/alien-anatomy Perhaps this fictional thing could be living within the following portion of my artificially generated fractal universe: http://siggrapharts.ning.com/photo/heavenly-visions ;^) |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Sep 19 11:11PM -0700 On 9/19/2018 11:08 PM, Chris M. Thomasson wrote: >>>> On 09/19/2018 06:41 PM, bitrex wrote: >>>>> On 09/19/2018 01:35 PM, Rick C. Hodgin wrote: >>>>>> On 9/19/2018 12:15 PM, bitrex wrote: [...] > Perhaps this fictional thing could be living within the following > portion of my artificially generated fractal universe: > http://siggrapharts.ning.com/photo/heavenly-visions Fwiw, here are some higher resolution renderings: http://www.fractalforums.com/index.php?action=gallery;sa=view;id=17379 (Heavenly Visions) http://www.fractalforums.com/index.php?action=gallery;sa=view;id=17412 (Alien Anatomy) |
David Brown <david.brown@hesbynett.no>: Sep 20 09:43AM +0200 On 20/09/18 01:07, bitrex wrote: > but the jokes were a hundred times better. Why then claim they were by > someone else when you could just go be the greatest comedian ever > yourself instead? ??????? I don't think anyone would consider the Bible as a whole, or the Gospels in particular, as a "forgery". There is a limit to the amount of effort people would put in for a laugh, or for a money-making scam. But there is some historical evidence to show many aspects of where the books of the Bible came from, and some historical evidence regarding some of the characters in the Bible. There is also a significant lack of evidence for some other parts. In particular, there is a very small amount of evidence that there was a religious or philosophical teacher called "Jesus" in about the right time and place. While in general lack of evidence is not evidence of lack, the outstanding /lack/ of historical evidence and records surrounding Jesus means that it is very unlikely that there was such a person as described in the Bible. All we have is a couple of brief sentences in a few historian's notes, and the Gospels written long after the events by highly biased authors. The history that we /do/ have from that time and place do not match with the events described in the Gospels. Amongst the Jews of that time, there was a great deal of change - social and religious. There were /many/ wandering teachers and philosophers - and /many/ people who claimed to be messiahs, or were claimed to be messiahs by their followers. For quite a few of them, there is definite objective historical evidence - such as things written by Romans who had no personal interest in the events or people. To my sceptical historian mind, it seems most likely that the Gospels were written based on word-of-mouth stories passed on by various people in several stages of Chinese Whispers, and which had been set together based on the teachings and events of several of these prophets/teachers/messiahs. And everything has got muddled and exaggerated along the way as the mystical and miraculous aspects got added. That does not make the book a forgery - nor does it mean there is no god or Jesus. (It's up to each individual to figure out what, if anything, they believe about God.) But I think you have to be very gullible or desperate to take the Bible at face value or the literal truth. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 19 11:47PM +0100 On 19/09/2018 20:24, Mr Flibble wrote: > Nobody cares. Your CAlive programming language is as batshit crazy as you > are. Maybe you should suggest it to the TempleOS guy as he is as batshit > crazy (and bigoted) as you. Alas it seems Terry A Davis has passed away (struck from the back and killed by a Union Pacific train). http://www.thedalleschronicle.com/news/2018/sep/07/man-killed-train-had-tech-following/ His demons can torment him no more. R.I.P. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Ian Collins <ian-news@hotmail.com>: Sep 20 10:28AM +1200 On 20/09/18 09:13, David Brown wrote: > You can run C++ in a container too. > There are several Python implementations. Surely Jython, which is > Python run in a Java VM, is as sandboxed as Java? Oh no, not another language that eats all the RAM in one's machine... -- Ian. |
Tim Rentsch <txr@alumni.caltech.edu>: Sep 19 06:13PM -0700 >> clarity, the ability to understand the main things at-a-glance. > Once, in another forum, I made the argument that using the std:: prefix > increases readability, rather than reduce it. Do you mean you gave reasons explaining your view, or simply stated your impression as an assertion (perhaps phrased as some sort of circular reasoning)? > For some reason which I can't really understand, some people seem to > think that if "std::" appears many times in the code, that somehow > makes it "cluttered" and "less readable". For reasons unknown. Oftentimes the reasons are unknown even to the people themselves. A large part of the challenge in such discussions is trying to draw out people on the other side of the fence, to see if it is possible to understand why they think what they think. And vice versa, which paradoxically often becomes harder the more strongly a preference is held. > To me that's as silly as saying that using capital letters at the > beginning of sentences makes the text "cluttered" and "less readable". Your view may seem just as silly to them. I don't always agree with Alf's views of things but I think most here would agree he makes an effort to be a thoughtful guy. If your views and his views on this choice are pretty much diametrically opposed, which it kind of looks like they are, what might be done to resolve, or at least understand, the underlying reaons for those differences? |
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