Deutsch English Français Italiano |
<20240912204121.482@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.c Subject: Re: Other programming languages (Was: Command line globber/tokenizer library for C?) Date: Fri, 13 Sep 2024 04:18:36 -0000 (UTC) Organization: A noiseless patient Spider Lines: 45 Message-ID: <20240912204121.482@kylheku.com> References: <lkbjchFebk9U1@mid.individual.net> <vbumi6$8ipp$1@dont-email.me> <vbupqe$1t2d8$1@news.xmission.com> <vbus74$9k96$3@raubtier-asyl.eternal-september.org> <vbusji$1t31q$2@news.xmission.com> <vbut08$9rul$1@raubtier-asyl.eternal-september.org> <vbv212$altk$1@dont-email.me> <vbvq59$esm6$10@dont-email.me> <vc06o4$l86t$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 13 Sep 2024 06:18:37 +0200 (CEST) Injection-Info: dont-email.me; posting-host="99dc7076b0b49591e69cd20e1421cb3c"; logging-data="739848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GxRpDP+ehA1ytoKLh//G/55zmC1Ql0Wg=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:Uz5EpTjkenbUDXivzYyr7ViCNMw= Bytes: 3484 On 2024-09-13, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote: > On 13.09.2024 00:32, Lawrence D'Oliveiro wrote: >> On Thu, 12 Sep 2024 17:40:17 +0200, Janis Papanagnou wrote: >> >>> A lot of early C++ programs I've seen were just, umm, "enhanced" "C" >>> programs. >> >> Given that C++ makes “virtual” optional instead of standard behaviour, I’d >> say that C++ is in fact designed to be used that way. > > There's different semantics with and without a 'virtual' specification. > > Even if you want polymorphism (and have to use 'virtual') there's no > need to define it as _default_ (and "disable" it where unnecessary). Thd development of C++ follows, or at least used to, a "don't pay for what you don't use" principle: programs not using certain mechanisms that have an implementation cost should not ideally bear the cost of implementing them. When a class doesn't use virtual functions, that class doesn't need the "vtable" implementation mechanism. And even if functions are called through pointers or references to the object, the dispatch is static. That would not be the case with virtuals, because a class must be suspected of being a base class. This "don't pay for what you don't use" principle doesn't mean that the language is designed to be used with a preference toward the cheap choices. It's just pragmatics. Programs do not all use all available features, so why turn them on? A program which needs no special features that have an implementation cost would then have to verbiage to opt-out of all of them. Moreover, old programs would have to be maintained to add more verbiage to opt out of newer hidden expenses that have been made default. We can imagine the "ls" program was designed such that a large number of options were enabled at the same time, such that users have to turn off what they don't need. It does not follow that just because things are not that way (options sanely optional) that doesn't imply that ls is designed to be used with no options. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca