Compilation of lengthy C++ Files
Kai Song
kaisong1515@gmail.com
Sat Oct 21 14:10:52 GMT 2023
Thank you to Jonathan and Paul for clarifying the scope of the discussion.
I was under the impression that the goal was to move the subject at "if
your code is too long you have to refactor it", which I interpreted after
all as "you must be doing something wrong". Because we both proceeded by
alternately replying with the same piece of information.
Today I did implement a cpp program that will evaluate a file containing a
formula of length N and its derivative in O(N), compiled with GCC :D. Of
course my program can only treat very trivial files and is slow but for
most of my tasks that does not matter. I understand (and needless to say
couldn't do it better) that it may just be for now a too difficult problem
to actually compile lengthy cpp. The question that I was targeting at is:
What can I realistically do (implying that refactoring in the remaining
project's period appears nonviable)? The formula evaluator programs helps
for a subset of these problems, clearly. Are there languages with similar
capabilities to cpp that I could generate into equivalently and that are as
easy to learn (i.e., excluding assembly or any languages that won't permit
templates or flexible types)?
My initial phrasing of "how can I complie my code?" was wrong as I can see
now. It should have been "how can I somehow just make it so I can evaluate
it?, particularly when I see myself unable for now to transform it into
equivalent shorter code?"
On Sat, Oct 21, 2023 at 8:52 AM Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:
>
>
> On Fri, 20 Oct 2023, 23:04 Paul Smith via Gcc-help, <gcc-help@gcc.gnu.org>
> wrote:
>
>> On Fri, 2023-10-20 at 23:08 +0200, Kai Song via Gcc-help wrote:
>> > Yes. I have invested time on my end to cause some understanding for
>> > an issue.
>>
>> Maybe I can provide context. Note I'm not a GCC developer although I
>> have worked on compiler implementations in the past.
>>
>> The C++ standard defines an abstract definition. Individual
>> implementations of compilers for the C++ standard will have limitations
>> on the abstract definition, obviously: computers are not abstract and
>> so they are limited.
>>
>
> And this is explicitly called out in the C++ standard:
> https://eel.is/c++draft/intro.compliance#general-2.1
> https://eel.is/c++draft/implimits
>
>
> Kai, we are not sceptics who are doubting your marvelous theories. It is
> an empirical fact that gcc will fail to compile ridiculously large
> functions written in your preferred coding style. Some of us have tried to
> suggest alternatives that might have more success.
>
> At this point I consider any further engagement in this thread to be a
> waste of time. You have answers to your questions now, but you seem
> unwilling to take the advice given.
>
> Good luck compiling your ridiculously constructed programs.
>
>
>
More information about the Gcc-help
mailing list