C++ Logo


Advanced search

Re: [std-proposals] Derived class's function invokes base class's function

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Fri, 15 Apr 2022 08:32:30 +0100
On 4/14/22, Jason McKesson via Std-Proposals wrote:
> Your proposal is way more complicated, and I think it will be far less
> useful to most C++ programmers.

I'm going to take Marcin's alternative solution and copy-paste it into
my document, then I will compare the two. The main difference between
Marcin's solution and my own new language feature is that my new
language feature is incredibly simple to use -- easier to use and less
error-prone as the compiler does all the technical work, less human

As for the complexity it will add to designing and coding compilers,
well I've started writing a pre-compiler for my new language feature.
You use it as follows:

(1) Take your .cpp file and run it through the preprocessor to give
you a translation unit
(2) Take your translation unit and run it through my pre-compiler
(3) Take the final translation unit and run it through a C++20 compiler

At the command line, you can pipe the 3 commands into a one-liner as follows:

g++ -std=c++20 -E -P main.cpp -o - | precompiler | g++ -std=c++20 -o
main.o -x c++ -c -

I'll need a week or so to have it working. You won't be able to use my
new language feature in a template class, nor in a template method (it
would take me ages to code the instantiation of templates). What I
might be able to do though is fork the 'g++' project and try to find
in the code the output after all templates have been instantiated. For
now though my own 'precompiler without template-support' will suffice.

Received on 2022-04-15 07:32:32