Path: csiph.com!aioe.org!.POSTED.ElFVPqY+TvFDjG0suNPrQQ.user.gioia.aioe.org!not-for-mail From: Manfred Newsgroups: comp.lang.c Subject: Re: missing gcc attribute "overwritable" Date: Sun, 5 Jul 2020 20:23:22 +0200 Organization: Aioe.org NNTP Server Lines: 52 Message-ID: References: <91376443-615e-460c-839c-cf748a673a55o@googlegroups.com> <14058fdd-da38-491d-94ab-fb42e6c876a4o@googlegroups.com> NNTP-Posting-Host: ElFVPqY+TvFDjG0suNPrQQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.c:153066 On 7/5/2020 10:34 AM, aotto1968zwei@gmail.com wrote: > Am Freitag, 3. Juli 2020 09:38:02 UTC+2 schrieb aotto1...@gmail.com: >> Am Freitag, 3. Juli 2020 04:33:06 UTC+2 schrieb donal...@gmail.com: >>> On Thursday, July 2, 2020 at 1:56:33 PM UTC-4, aotto1...@gmail.com wrote: > After think about It, I come to the conclusion that it would be better to switch from: >> __attribute__((overwritable)) > to the keyword "overwrite". > 1. "overwrite" have to be applied to the OVERWRITING function and NOT to the > OVERWRITTEN function, this mean that OVERWRITABLE is the default. > 2. This correspond with the c# definition of "override" > In the google translate the "overwrite" and the "override" are both the > same, the German word "überschreiben" > 3. the "overwrite" will BREAK the c-syntax - NO compiler WITHOUT "overwrite" > feature will be able to translate this code > 4. the new keyword "overwrite" implicit "static". It appears you have changed the goal from manual adjustment of some generated library code to polymorphism - which is what the "override" keyword is about in C++ (and other languages including C#) There are very good reasons for which polymorphism is explicitly part of the OO design[*], and it applies only to member functions, not global (or static) functions. In fact, even in C polymorphism is typically implemented via function pointers inside some data structure (although C can have global function pointers as well). Back to the original point, IIUC this feature was supposed to "ease" the work of the programmer when adjusting some generated code. If so, you are envisioning an environment where you have some "bad" code generated by some tool, and "good" handwritten code that should replace the bad one - however, both the bad and the good code should survive in the product (otherwise there's no point in asking the compiler to replace anything). /If/ this is what this is about, my opinion is that it is not going to make anyone's life easier. [*] In fact when he first introduced virtual functions Stroustrup was criticized by some computer scientists at the time - the objection was that if the programmer does not know what some function does at the point of calling, then the software design is poor; the answer is that polymorphism does make sense in the context of object semantics. > > Example: