Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c++ Subject: Re: C++ named requirements as concepts Date: Sun, 29 Sep 2024 14:37:57 +0300 Organization: A noiseless patient Spider Lines: 31 Message-ID: <20240929143757.00000336@yahoo.com> References: <20240925131144.00004c38@yahoo.com> <20240925151723.00006aa3@yahoo.com> <86h6a15tuv.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Sun, 29 Sep 2024 13:37:28 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b1c937c2e7b01fb16cab4b41feb8475c"; logging-data="1825124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GrlSApGHjyJvqe1aSWscUCkuZDLIrd1g=" Cancel-Lock: sha1:9hpTrB81KFa0CoTIEtire1Ky9mg= X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32) Xref: csiph.com comp.lang.c++:120445 On Sat, 28 Sep 2024 17:33:46 +0200 David Brown wrote: > On 28/09/2024 11:12, Muttley@dastardlyhq.com wrote: > > On Fri, 27 Sep 2024 18:24:11 +0200 > > David Brown gabbled: > >> > >> This cannot be done with a series of cmp/jmp instructions - it > >> ends up as an indirect call instruction. > > > > It could quite easily, but yes, a call is more likely. Point still > > stands however. > > > > No, it could not be done - thus your point does /not/ stand. > It could be done. It could be done relatively easily with whole program compiler. Without whole program compiler it still could be done, but would need some co-operation from linker that would have to glue code segments. I'd guess, majority of linkers already can do something of this sort for other purposes. Of course, if class hierarchy is sufficiently big then implementation based on comparisons, branches and direct calls would be rather inefficient relatively to indirect call (actually dual-indirect call in most typical C++ implementations). They point that you were probably missing when claiming that it is impossible is that every instance of given class can carry its Class Id.