- strange issue ... - 8 Updates
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 09 06:36PM +0100 On 09/10/2019 16:22, Bonita Montero wrote: > static const members never need to be defined. And when you don't > take their address or a reference to it they're are constant. Why > should other program-parts change this? If they never need to be defined then how will the compiler know which translation unit to put them in if you are taking their address? Rely on the linker to sort it out? You were told what to do like two days ago: use constexpr. Now please STFU as this thread is getting tedious. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "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." |
James Kuyper <jameskuyper@alumni.caltech.edu>: Oct 09 01:42PM -0400 On 10/9/19 12:59 PM, Öö Tiib wrote: > not because of requirements to it. But changing non-odr-access to > odr-access of unrelated const isn't crash nor hang so what you > complain? Whatever the cause, his program failed to link. That seems to justify complaint (at least, if it's the compiler's fault rather than a defect in his code). |
Bonita Montero <Bonita.Montero@gmail.com>: Oct 09 09:48PM +0200 > Technically compiler is permitted to crash or to hang on case of > undefined behavior in code that it compiles. There is no undefined behaviour with what I do. |
Bonita Montero <Bonita.Montero@gmail.com>: Oct 09 09:50PM +0200 > If they never need to be defined then how will the compiler know which > translation unit to put them in if you are taking their address? Rely > on the linker to sort it out? There's no need to sort a non-odr-access out because it isn't any access at all. > You were told what to do like two days ago: use constexpr. > Now please STFU as this thread is getting tedious. Don't read this thread if you don't like. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Oct 09 01:23PM -0700 On Wednesday, October 9, 2019 at 3:48:42 PM UTC-4, Bonita Montero wrote: > > Technically compiler is permitted to crash or to hang on case of > > undefined behavior in code that it compiles. > There is no undefined behaviour with what I do. It's fairly clear from your posting history that you're not a particularly good judge of that. Since you are unwilling to post an example demonstrating the problem, none of the many people on this newsgroup who are better equipped to judge such issues than you are can confirm your belief. I was unable to reproduce your problem by writing simple code of my own which matched every detail you gave us about the context of that code. Therefore, it's a certainty that something you haven't told us about your program is responsible for the results that you got. There's no way for us to know whether the part you haven't told us about triggers a bug in gcc, or is itself a bug. However, under the circumstances, if I were a gambling man, my money would be on the latter possibility. And since nothing I say shows any sign of eliciting any more information from you about the context than you've already given us, I think I'll bow out of this discussion. |
scott@slp53.sl.home (Scott Lurndal): Oct 09 09:26PM Bonita Montero <Bonita.Montero@gmail.com> Quoted James Kyuper (and elided the references, the twit): >> on the linker to sort it out? >There's no need to sort a non-odr-access out because it isn't any access >at all. Clearly reading for comprehension isn't one of your sterling qualities. The compiler cannot know, a priori, that there is only one translation unit. And for most real-world code, that's indeed the case. Because of that the compiler _cannot_ deduce that no other part of the program ever takes the address of the constant. Therefore, the compiler _must_ emit an external reference to the constant allowing the linker to resolve the symbol with respect to other translation units. One of which must contain the actual definition. gcc, when compiled with the appropriate optimization level will elide the external reference entirely at compile time instead of emitting the external reference to the symbol. It becomes surprising, then, to many programmers when their program won't link when compiled without optimization. |
Ian Collins <ian-news@hotmail.com>: Oct 10 10:47AM +1300 On 10/10/2019 06:36, Mr Flibble wrote: > the linker to sort it out? > You were told what to do like two days ago: use constexpr. Now please > STFU as this thread is getting tedious. Indeed. I've no idea why people keep engaging with someone who is only here to troll and never listens. -- Ian |
James Kuyper <jameskuyper@alumni.caltech.edu>: Oct 09 06:34PM -0400 On 10/9/19 5:26 PM, Scott Lurndal wrote: > Bonita Montero <Bonita.Montero@gmail.com> Quoted James Kyuper (and elided the references, the > twit): That provides an example of why attributions are needed. The missing attributions would have referred to Mr. Fibble, not me. |
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