Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #70077 > unrolled thread

A question about if constexpr

Started byDaniel <danielaparker@gmail.com>
First post2019-11-27 05:45 -0800
Last post2019-12-01 14:42 +0100
Articles 20 on this page of 49 — 14 participants

Back to article view | Back to comp.lang.c++


Contents

  A question about if constexpr Daniel <danielaparker@gmail.com> - 2019-11-27 05:45 -0800
    Re: A question about if constexpr "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-11-27 15:03 +0100
      Re: A question about if constexpr Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-11-29 16:33 +0000
        Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-29 16:52 -0800
          Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-30 12:03 +0100
            Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 03:47 -0800
              Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-30 15:08 +0100
    Re: A question about if constexpr Sam <sam@email-scan.com> - 2019-11-27 18:40 -0500
      Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-27 23:16 -0800
        Re: A question about if constexpr Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-11-29 16:35 +0000
          Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-29 16:41 -0800
      Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-28 10:24 +0100
        Re: A question about if constexpr Bo Persson <bo@bo-persson.se> - 2019-11-28 11:58 +0100
          Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-28 12:37 +0100
          Re: A question about if constexpr Robert Wessel <robertwessel2@yahoo.com> - 2019-11-28 14:04 -0600
            Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-29 09:23 +0100
              Re: A question about if constexpr Robert Wessel <robertwessel2@yahoo.com> - 2019-11-29 14:42 -0600
        Re: A question about if constexpr Daniel <danielaparker@gmail.com> - 2019-11-28 21:09 -0800
          Re: A question about if constexpr "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-11-29 07:41 +0100
          Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-28 23:50 -0800
            Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-29 09:38 +0100
              Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-29 17:15 -0800
                Re: A question about if constexpr Paavo Helde <myfirstname@osa.pri.ee> - 2019-11-30 08:19 +0200
                  Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-11-30 00:24 -0600
                    Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 02:13 -0800
                      Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-11-30 04:56 -0600
                        Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 03:20 -0800
                          Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-11-30 05:38 -0600
                            Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 04:57 -0800
                              Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-11-30 09:46 -0600
                                Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 11:09 -0800
                                  Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-11-30 20:03 -0600
                                    Re: A question about if constexpr Öö Tiib <ootiib@hot.ee> - 2019-11-30 23:43 -0800
                                      Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-01 04:56 -0600
                                        Re: A question about if constexpr Christian Gollwitzer <auriocus@gmx.de> - 2019-12-01 18:33 +0100
                                          Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-01 19:27 -0600
                                            Re: A question about if constexpr boltar@nowhere.co.uk - 2019-12-02 08:34 +0000
                                              Re: A question about if constexpr Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-02 04:21 -0600
                                          Re: A question about if constexpr boltar@nowhere.co.uk - 2019-12-02 08:33 +0000
                                          Re: A question about if constexpr Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-03 17:05 +0000
                                            Re: A question about if constexpr boltar@nowhere.co.uk - 2019-12-03 17:09 +0000
                                              Re: A question about if constexpr Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-03 18:03 +0000
                                                Re: A question about if constexpr boltar@nowhere.co.uk - 2019-12-04 16:49 +0000
                                                  Re: A question about if constexpr Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2019-12-04 18:36 +0000
                                                    Re: A question about if constexpr boltar@nowhere.co.uk - 2019-12-05 12:51 +0000
          Re: A question about if constexpr David Brown <david.brown@hesbynett.no> - 2019-11-29 09:30 +0100
        Re: A question about if constexpr Paavo Helde <myfirstname@osa.pri.ee> - 2019-11-29 10:51 +0200
    Re: A question about if constexpr Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-28 13:52 -0800
    Re: A question about if constexpr Bonita Montero <Bonita.Montero@gmail.com> - 2019-12-01 14:42 +0100

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#70143

FromDavid Brown <david.brown@hesbynett.no>
Date2019-11-29 09:38 +0100
Message-ID<qrqldf$dbu$1@dont-email.me>
In reply to#70139
On 29/11/2019 08:50, Öö Tiib wrote:
> On Friday, 29 November 2019 07:09:19 UTC+2, Daniel  wrote:
>> On Thursday, November 28, 2019 at 4:25:03 AM UTC-5, David Brown wrote:
>>>
>>> If the compiler is not
>>> generating identical code for an "if constexpr" and an "if" where the
>>> expression happens to be known at compile time (whether it is
>>> technically a C++ constant or not), then the compiler is doing a poor
>>> job at optimising.
>>>
>> Which raises the question, what is the point of the constexpr if statement anyway? 
> 
> In template code it is like super #if but outside of templates it is
> basically only for to tell to readers, maintainers and compiler that
> the condition is supposed to be constant expression by original logic
> and something is perhaps gone bad when it is not anymore.
> 

<https://en.cppreference.com/w/cpp/language/if>

One other point is that since the discarded part is discarded, any
identifiers it uses do not need to be defined or linked in with the code.

[toc] | [prev] | [next] | [standalone]


#70161

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-29 17:15 -0800
Message-ID<4ba97dfb-e642-4f0d-a129-60fdcb4999ee@googlegroups.com>
In reply to#70143
On Friday, 29 November 2019 10:38:18 UTC+2, David Brown  wrote:
> On 29/11/2019 08:50, Öö Tiib wrote:
> > On Friday, 29 November 2019 07:09:19 UTC+2, Daniel  wrote:
> >> On Thursday, November 28, 2019 at 4:25:03 AM UTC-5, David Brown wrote:
> >>>
> >>> If the compiler is not
> >>> generating identical code for an "if constexpr" and an "if" where the
> >>> expression happens to be known at compile time (whether it is
> >>> technically a C++ constant or not), then the compiler is doing a poor
> >>> job at optimising.
> >>>
> >> Which raises the question, what is the point of the constexpr if statement anyway? 
> > 
> > In template code it is like super #if but outside of templates it is
> > basically only for to tell to readers, maintainers and compiler that
> > the condition is supposed to be constant expression by original logic
> > and something is perhaps gone bad when it is not anymore.
> > 
> 
> <https://en.cppreference.com/w/cpp/language/if>
> 
> One other point is that since the discarded part is discarded, any
> identifiers it uses do not need to be defined or linked in with the code.

I'm in doubt about that other point. I noticed it long time ago that
the implementations do not link useless functions. It was like 2004
or maybe 2007.

I did delete unused functions after refactoring and since there
was tens of such I used impossibility to set breakpoints in those
as heuristic that these are now unused.

However my program became ill-formed since I had erased one that
was optimized out but not because it wasn't called but because it
was called only in branch that was impossible to take. 

So compilers did not need if constexpr back then for it ... why
these suddenly started to need it now?

[toc] | [prev] | [next] | [standalone]


#70162

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2019-11-30 08:19 +0200
Message-ID<qrt1l5$50d$1@dont-email.me>
In reply to#70161
On 30.11.2019 3:15, Öö Tiib wrote:
> On Friday, 29 November 2019 10:38:18 UTC+2, David Brown  wrote:
>> One other point is that since the discarded part is discarded, any
>> identifiers it uses do not need to be defined or linked in with the code.
>
> I'm in doubt about that other point. I noticed it long time ago that
> the implementations do not link useless functions. It was like 2004
> or maybe 2007.
>
> I did delete unused functions after refactoring and since there
> was tens of such I used impossibility to set breakpoints in those
> as heuristic that these are now unused.
>
> However my program became ill-formed since I had erased one that
> was optimized out but not because it wasn't called but because it
> was called only in branch that was impossible to take.
>
> So compilers did not need if constexpr back then for it ... why
> these suddenly started to need it now?
>

You answered that yourself: constexpr is needed to make your ill-formed 
program well-formed again.

[toc] | [prev] | [next] | [standalone]


#70163

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-11-30 00:24 -0600
Message-ID<slrnqu42p2.fus.nedlatham@woden.valhalla.oz>
In reply to#70162
Paavo Helde wrote:
> Öö Tiib wrote:
> > David Brown  wrote:
> > >
> > > One other point is that since the discarded part is discarded, any
> > > identifiers it uses do not need to be defined or linked in with the code.
> >
> > I'm in doubt about that other point. I noticed it long time ago that
> > the implementations do not link useless functions. It was like 2004
> > or maybe 2007.
> >
> > I did delete unused functions after refactoring and since there
> > was tens of such I used impossibility to set breakpoints in those
> > as heuristic that these are now unused.
> >
> > However my program became ill-formed since I had erased one that
> > was optimized out but not because it wasn't called but because it
> > was called only in branch that was impossible to take.
> >
> > So compilers did not need if constexpr back then for it ... why
> > these suddenly started to need it now?
> >
>
> You answered that yourself: constexpr is needed to make your ill-formed 
> program well-formed again.

No. What would make his program well formed is the removal of that
"branch that [is] impossible to take".

(HTF doesd one *write* such a branch?)

[toc] | [prev] | [next] | [standalone]


#70164

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-30 02:13 -0800
Message-ID<19cb67a9-ed06-4c1c-90a0-a528bbdb9b1a@googlegroups.com>
In reply to#70163
On Saturday, 30 November 2019 08:24:49 UTC+2, Ned Latham  wrote:
> Paavo Helde wrote:
> > 嘱 Tiib wrote:
> > > David Brown  wrote:
> > > >
> > > > One other point is that since the discarded part is discarded, any
> > > > identifiers it uses do not need to be defined or linked in with the code.
> > >
> > > I'm in doubt about that other point. I noticed it long time ago that
> > > the implementations do not link useless functions. It was like 2004
> > > or maybe 2007.
> > >
> > > I did delete unused functions after refactoring and since there
> > > was tens of such I used impossibility to set breakpoints in those
> > > as heuristic that these are now unused.
> > >
> > > However my program became ill-formed since I had erased one that
> > > was optimized out but not because it wasn't called but because it
> > > was called only in branch that was impossible to take.
> > >
> > > So compilers did not need if constexpr back then for it ... why
> > > these suddenly started to need it now?
> > >
> >
> > You answered that yourself: constexpr is needed to make your ill-formed 
> > program well-formed again.
> 
> No. What would make his program well formed is the removal of that
> "branch that [is] impossible to take".

+1 That did make it.

> (HTF doesd one *write* such a branch?)

It was the effect of evolution. About like that one developer wrote
a new feature, other fixed some issue in it and third implemented 
an improvement. Details in if condition did change during the process
so it turned into always false. Neither those programmers nor reviewers
of their pull requests did notice that. Perhaps there was some mile-
stone pressing as it often is. Then it was released, real data arrived
(with what performance of it was weak) and that refactoring took place.

[toc] | [prev] | [next] | [standalone]


#70168

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-11-30 04:56 -0600
Message-ID<slrnqu4inb.g5u.nedlatham@woden.valhalla.oz>
In reply to#70164
Öö Tiib wrote:
> Ned Latham  wrote:
> > Paavo Helde wrote:
> > > Öö Tiib wrote:
> > > > David Brown  wrote:
> > > > >
> > > > > One other point is that since the discarded part is discarded,
> > > > > any identifiers it uses do not need to be defined or linked in
> > > > > with the code.
> > > >
> > > > I'm in doubt about that other point. I noticed it long time ago that
> > > > the implementations do not link useless functions. It was like 2004
> > > > or maybe 2007.
> > > >
> > > > I did delete unused functions after refactoring and since there
> > > > was tens of such I used impossibility to set breakpoints in those
> > > > as heuristic that these are now unused.
> > > >
> > > > However my program became ill-formed since I had erased one that
> > > > was optimized out but not because it wasn't called but because it
> > > > was called only in branch that was impossible to take.
> > > >
> > > > So compilers did not need if constexpr back then for it ... why
> > > > these suddenly started to need it now?
> > >
> > > You answered that yourself: constexpr is needed to make your ill-formed
> > > program well-formed again.
> >
> > No. What would make his program well formed is the removal of that
> > "branch that [is] impossible to take".
>
> +1 That did make it.

Glad to help. You've erased the function it called as well?

> > (HTF does one *write* such a branch?)
>
> It was the effect of evolution. About like that one developer wrote
> a new feature, other fixed some issue in it and third implemented
> an improvement. Details in if condition did change during the process
> so it turned into always false. Neither those programmers nor reviewers
> of their pull requests did notice that. Perhaps there was some mile-
> stone pressing as it often is.

I've been there. The commercial environment is hostile to thoroughness.

>                                Then it was released, real data arrived
> (with what performance of it was weak) and that refactoring took place.

I have some difficulty with the mindset behind program development
these days; IDEs provide features that make routine programming
easier, but get in the way of the unorthodox approach; compilers
do the same; even operating systems can be a nuisance.

I cut my teeth on assembly-language programming on CP/M machines;
thoroughness is productive in that environment, and it translated
well for me into HLLs.

[toc] | [prev] | [next] | [standalone]


#70171

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-30 03:20 -0800
Message-ID<88b994d3-1b5e-4911-89d8-7009afe67089@googlegroups.com>
In reply to#70168
On Saturday, 30 November 2019 12:56:59 UTC+2, Ned Latham  wrote:
> Öö Tiib wrote:
> > Ned Latham  wrote:
> > > Paavo Helde wrote:
> > > > Öö Tiib wrote:
> > > > > David Brown  wrote:
> > > > > >
> > > > > > One other point is that since the discarded part is discarded,
> > > > > > any identifiers it uses do not need to be defined or linked in
> > > > > > with the code.
> > > > >
> > > > > I'm in doubt about that other point. I noticed it long time ago that
> > > > > the implementations do not link useless functions. It was like 2004
> > > > > or maybe 2007.
> > > > >
> > > > > I did delete unused functions after refactoring and since there
> > > > > was tens of such I used impossibility to set breakpoints in those
> > > > > as heuristic that these are now unused.
> > > > >
> > > > > However my program became ill-formed since I had erased one that
> > > > > was optimized out but not because it wasn't called but because it
> > > > > was called only in branch that was impossible to take.
> > > > >
> > > > > So compilers did not need if constexpr back then for it ... why
> > > > > these suddenly started to need it now?
> > > >
> > > > You answered that yourself: constexpr is needed to make your ill-formed
> > > > program well-formed again.
> > >
> > > No. What would make his program well formed is the removal of that
> > > "branch that [is] impossible to take".
> >
> > +1 That did make it.
> 
> Glad to help. You've erased the function it called as well?

That happened in previous step:
1) Compiler left it out from executable, 
2) I erased it from code since break-point was impossible to set in it,
3) I erased the worthless branch that stopped to compile.

> 
> > > (HTF does one *write* such a branch?)
> >
> > It was the effect of evolution. About like that one developer wrote
> > a new feature, other fixed some issue in it and third implemented
> > an improvement. Details in if condition did change during the process
> > so it turned into always false. Neither those programmers nor reviewers
> > of their pull requests did notice that. Perhaps there was some mile-
> > stone pressing as it often is.
> 
> I've been there. The commercial environment is hostile to thoroughness.
> 
> >                                Then it was released, real data arrived
> > (with what performance of it was weak) and that refactoring took place.
> 
> I have some difficulty with the mindset behind program development
> these days; IDEs provide features that make routine programming
> easier, but get in the way of the unorthodox approach; compilers
> do the same; even operating systems can be a nuisance.
> 
> I cut my teeth on assembly-language programming on CP/M machines;
> thoroughness is productive in that environment, and it translated
> well for me into HLLs.

Yes, it has gone harder since all tools have became easier to use
but also the targets are more complicated. It is tried to solve
by adding more programmers but synchronizing their effort is also
an effort. At the end everybody's vision of what is going on is
naive but things get somehow done.

[toc] | [prev] | [next] | [standalone]


#70172

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-11-30 05:38 -0600
Message-ID<slrnqu4l6j.g7j.nedlatham@woden.valhalla.oz>
In reply to#70171
Öö Tiib wrote:
> Ned Latham wrote:

----snip----

> > I have some difficulty with the mindset behind program development
> > these days; IDEs provide features that make routine programming
> > easier, but get in the way of the unorthodox approach; compilers
> > do the same; even operating systems can be a nuisance.
>
> Yes, it has gone harder since all tools have became easier to use
> but also the targets are more complicated. It is tried to solve
> by adding more programmers but synchronizing their effort is also
> an effort. At the end everybody's vision of what is going on is
> naive but things get somehow done.

That "somehow" bothers me. It's what started the over-complication
of the programming environment in the first place, IMO, and it
continues to influence development in all areas.

[toc] | [prev] | [next] | [standalone]


#70174

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-30 04:57 -0800
Message-ID<7febe251-6681-4367-a02b-a1345d89ab9f@googlegroups.com>
In reply to#70172
On Saturday, 30 November 2019 13:39:12 UTC+2, Ned Latham  wrote:
> Öö Tiib wrote:
> > Ned Latham wrote:
> 
> ----snip----
> 
> > > I have some difficulty with the mindset behind program development
> > > these days; IDEs provide features that make routine programming
> > > easier, but get in the way of the unorthodox approach; compilers
> > > do the same; even operating systems can be a nuisance.
> >
> > Yes, it has gone harder since all tools have became easier to use
> > but also the targets are more complicated. It is tried to solve
> > by adding more programmers but synchronizing their effort is also
> > an effort. At the end everybody's vision of what is going on is
> > naive but things get somehow done.
> 
> That "somehow" bothers me. It's what started the over-complication
> of the programming environment in the first place, IMO, and it
> continues to influence development in all areas.

It has been going on for long time. Notice that the project was in
mid 2000's. Currently teams of teams of programmers of random skill
levels are doing any (even embedded) projects. It is more like norm. 
So piles of such somehow made stuff is of what our economies consist
of.

But what can we do? Imagine that we organize some kind of "order of
masters" to fight with garbage and for virtue of master. Imagine
that we gain power and popularity. Then some monster (Google,
Microsoft, Amazon, SAP, Oracle, Apple or combo of such) will figure
out how to weaken it, buy it, fill with weasels and noobs and use it
for producing and marketing of even more garbage. ;)
It is hard to do something that is tricky to hack with power of
monsters. But maybe worth to try? :D

[toc] | [prev] | [next] | [standalone]


#70176

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-11-30 09:46 -0600
Message-ID<slrnqu53nj.gk3.nedlatham@woden.valhalla.oz>
In reply to#70174
Öö Tiib wrote:
> Ned Latham  wrote:
>> Öö Tiib wrote:
>> > Ned Latham wrote:
>> 
>> ----snip----
>> 
>> > > I have some difficulty with the mindset behind program development
>> > > these days; IDEs provide features that make routine programming
>> > > easier, but get in the way of the unorthodox approach; compilers
>> > > do the same; even operating systems can be a nuisance.
>> >
>> > Yes, it has gone harder since all tools have became easier to use
>> > but also the targets are more complicated. It is tried to solve
>> > by adding more programmers but synchronizing their effort is also
>> > an effort. At the end everybody's vision of what is going on is
>> > naive but things get somehow done.
>> 
>> That "somehow" bothers me. It's what started the over-complication
>> of the programming environment in the first place, IMO, and it
>> continues to influence development in all areas.
>
> It has been going on for long time. Notice that the project was in
> mid 2000's. Currently teams of teams of programmers of random skill
> levels are doing any (even embedded) projects. It is more like norm. 
> So piles of such somehow made stuff is of what our economies consist
> of.
>
> But what can we do? Imagine that we organize some kind of "order of
> masters" to fight with garbage and for virtue of master. Imagine
> that we gain power and popularity. Then some monster (Google,
> Microsoft, Amazon, SAP, Oracle, Apple or combo of such) will figure
> out how to weaken it, buy it, fill with weasels and noobs and use it
> for producing and marketing of even more garbage. ;)
> It is hard to do something that is tricky to hack with power of
> monsters. But maybe worth to try? :D

Funny you should mention that. I have a project XBNF, which is an
eXtended Backus Naur Formalism (like EBNF but extended a little
more), and a co-project xbnf, which is a machine reader for XBNF.

If you give xbnf the XBNF definition of the syntax of a programming
language and the XBNF definition of syntax errors in that language,
and matching error messages, it will check the syntax for you and
emit error messages. You can give it other XBNF definitions too;
matching program commands and High Level Language Productions (HLLP),
to emit the first stage of a compilation.

XBNF can also define the syntax matching HHLPs with Assembly Language
Productions, and OS Productions, and Machine Architecture Productions;
with all that xbnf becomes a full-flown compiler capable of running on
any machine it can be compiled for, and capable of compiling code in
any programming language whatever, for any OS whatever, and to run on
pretty much on any machine whatever.

Configuration (writing all those syntax files) will be a bitch without
a share setup, and as a compiler, it'll be pretty simple, but you'll
be able to define (say) C++ with or without things like constexpr as
suits you. We'll be free of the tyranny of the compiler-writers. It's
a hacker's wet dream.

And it's open source. Anyone who gets a copy is an obstacle to the
corporates that would sabotage it.

If I can get it done.

[toc] | [prev] | [next] | [standalone]


#70182

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-30 11:09 -0800
Message-ID<c764442e-586d-465c-8835-6d5bda70e4d2@googlegroups.com>
In reply to#70176
On Saturday, 30 November 2019 17:47:15 UTC+2, Ned Latham  wrote:
> Öö Tiib wrote:
> >
> > But what can we do? Imagine that we organize some kind of "order of
> > masters" to fight with garbage and for virtue of master. Imagine
> > that we gain power and popularity. Then some monster (Google,
> > Microsoft, Amazon, SAP, Oracle, Apple or combo of such) will figure
> > out how to weaken it, buy it, fill with weasels and noobs and use it
> > for producing and marketing of even more garbage. ;)
> > It is hard to do something that is tricky to hack with power of
> > monsters. But maybe worth to try? :D
> 
> Funny you should mention that. I have a project XBNF, which is an
> eXtended Backus Naur Formalism (like EBNF but extended a little
> more), and a co-project xbnf, which is a machine reader for XBNF.
> 
> If you give xbnf the XBNF definition of the syntax of a programming
> language and the XBNF definition of syntax errors in that language,
> and matching error messages, it will check the syntax for you and
> emit error messages. You can give it other XBNF definitions too;
> matching program commands and High Level Language Productions (HLLP),
> to emit the first stage of a compilation.
> 
> XBNF can also define the syntax matching HHLPs with Assembly Language
> Productions, and OS Productions, and Machine Architecture Productions;
> with all that xbnf becomes a full-flown compiler capable of running on
> any machine it can be compiled for, and capable of compiling code in
> any programming language whatever, for any OS whatever, and to run on
> pretty much on any machine whatever.

Sounds like you are also claiming doing what Mr Flibble is claiming doing.
Very interesting. If neither Mr Flibble nor you are just trolling then
may be you should try to cooperate or to compete or something like that.

> Configuration (writing all those syntax files) will be a bitch without
> a share setup, and as a compiler, it'll be pretty simple, but you'll
> be able to define (say) C++ with or without things like constexpr as
> suits you. We'll be free of the tyranny of the compiler-writers. It's
> a hacker's wet dream.

However to produce a translator of sophisticated modern programming
language (by programming or by configuring something) it will take
years of work of decent specialists.

> And it's open source. Anyone who gets a copy is an obstacle to the
> corporates that would sabotage it.
> 
> If I can get it done.

Yeah ... and then there is "one ring" of Sauron open sourced. :D
I meant with "master" people who are willing to learn to be aware of
what they have produced into this world and also to learn capability
to carry the weight of responsibility for it. Since monsters 
apparently don't care about it.

[toc] | [prev] | [next] | [standalone]


#70183

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-11-30 20:03 -0600
Message-ID<slrnqu67re.i6r.nedlatham@woden.valhalla.oz>
In reply to#70182
Öö Tiib wrote:
> Ned Latham  wrote:

----snip----

>>               xbnf becomes a full-flown compiler capable of running on
>> any machine it can be compiled for, and capable of compiling code in
>> any programming language whatever, for any OS whatever, and to run on
>> pretty much on any machine whatever.
>
> Sounds like you are also claiming doing what Mr Flibble is claiming doing.
> Very interesting. If neither Mr Flibble nor you are just trolling then
> may be you should try to cooperate or to compete or something like that.

Who is Mr Flibble?

----snip----

> However to produce a translator of sophisticated modern programming
> language (by programming or by configuring something) it will take
> years of work of decent specialists.

It'll all be in the configuration files; the first set will be for
Modula-C under linux on x86. After that, adding (say) C++ will require
one more file, adding (say) FreeBSD will require one more file, adding
(say) x86-64 will require one more file...

Only need to get one set right, then the community can take it over.

----snip----

[toc] | [prev] | [next] | [standalone]


#70184

FromÖö Tiib <ootiib@hot.ee>
Date2019-11-30 23:43 -0800
Message-ID<6f57cf86-5e10-4a8d-8c11-bfd49adc980d@googlegroups.com>
In reply to#70183
On Sunday, 1 December 2019 04:03:42 UTC+2, Ned Latham  wrote:
> Öö Tiib wrote:
> > Ned Latham  wrote:
> 
> ----snip----
> 
> >>               xbnf becomes a full-flown compiler capable of running on
> >> any machine it can be compiled for, and capable of compiling code in
> >> any programming language whatever, for any OS whatever, and to run on
> >> pretty much on any machine whatever.
> >
> > Sounds like you are also claiming doing what Mr Flibble is claiming doing.
> > Very interesting. If neither Mr Flibble nor you are just trolling then
> > may be you should try to cooperate or to compete or something like that.
> 
> Who is Mr Flibble?

A regular here ... can do C++ OK ... not too nice discussion partner.
Claimed that he will make his scripting engine language agnostic.
https://neogfx.org/
https://neos.dev/
Actual name is Leigh Johnston.


[toc] | [prev] | [next] | [standalone]


#70187

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-12-01 04:56 -0600
Message-ID<slrnqu772i.ijb.nedlatham@woden.valhalla.oz>
In reply to#70184
Öö Tiib wrote:
> Ned Latham wrote:

----snip----

> > Who is Mr Flibble?
>
> A regular here ... can do C++ OK ... not too nice discussion partner.
> Claimed that he will make his scripting engine language agnostic.
> https://neogfx.org/

API

> https://neos.dev/

Interesting. The combination of his language schema file and JIT looks
a little, but only a little, like the combination of XBNF and xbnf, imo:
neos relies on the API and on UTF-8 and .mix files... xbnf relies only
on the services of the OS (including the character set and the file
types) and on XBNF. All of the files are text files, easy for a program
to produce and amend, easy for a human to read and amend.

XBNF is no mere scripting language; it is a mathematical meta-language
capable of defining the syntax of any context-free grammar: VMs for
programming language, OS and the software model of the CPU. All simple
text.

I will have to make it into a community project somehow, but I don't
think there's a prospect of that until I get sufficient code and
syntax defined to show that it's workable.

> Actual name is Leigh Johnston.

I'll keep my eyes open. Thanks.

[toc] | [prev] | [next] | [standalone]


#70189

FromChristian Gollwitzer <auriocus@gmx.de>
Date2019-12-01 18:33 +0100
Message-ID<qs0th6$t32$1@dont-email.me>
In reply to#70187
Am 01.12.19 um 11:56 schrieb Ned Latham:
> XBNF is no mere scripting language; it is a mathematical meta-language
> capable of defining the syntax of any 

> context-free grammar: 
here is your problem: C is not context free. It is usually dealt with 
the "lexer hack" to use a parser for context-free grammar.

Also, parsing the syntax is only a minor step in most actual compilers. 
The big pile of work is in the optimizer (which is in theory optional) 
and the code generator, and another big pile is in the library. Pure C 
without the library is good for nothing.

That's why most regulars in this group are rather sceptical of Flibble's 
project. A more realistic approach would sit on top of LLVM, where years 
of work have been done already.


	Christian

[toc] | [prev] | [next] | [standalone]


#70190

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-12-01 19:27 -0600
Message-ID<slrnqu8q3p.jhj.nedlatham@woden.valhalla.oz>
In reply to#70189
Christian Gollwitzer wrote:
> schrieb Ned Latham:
> >
> > XBNF is no mere scripting language; it is a mathematical meta-language
> > capable of defining the syntax of any context-free grammar: 
>
> here is your problem:

There *is* no problem.

>                       C is not context free. It is usually dealt with 
> the "lexer hack" to use a parser for context-free grammar.

I am not trying to write something for C. (Though if the project's a
success, someone will eventually write an XBNF syntax definition of
it.)

> Also, parsing the syntax is only a minor step in most actual compilers. 

The point with XBNF is its flexibility and the fact that it *is* just a
meta-language. Syntaces can be written for every programming language,
every OS, every machine architecture and for every stage of a compilation.
In this system, the problems dealt with by the initial "lexer hack", are
dealt with by xbnf's use of symbol tables (somewhat like Clang, I guess).

> The big pile of work is in the optimizer (which is in theory optional) 

That is low a priority.

> and the code generator,

That's just a matter of writing XBNF syntax and output files for the CPU
software model.

>                         and another big pile is in the library. Pure C 
> without the library is good for nothing.

You're talking about the linker now, not the compiler.

> That's why most regulars in this group are rather sceptical of Flibble's 
> project. A more realistic approach would sit on top of LLVM, where years 
> of work have been done already.

Looks good.

But I'll continue with XBNF. If nothing else, it provides the open source
community with another alternative to the over-complication and versionitis
of present-day offerings, to the lack of access to machine idiosyncracies,
and to corporate rapacity.

[toc] | [prev] | [next] | [standalone]


#70192

Fromboltar@nowhere.co.uk
Date2019-12-02 08:34 +0000
Message-ID<qs2ib3$18r2$1@gioia.aioe.org>
In reply to#70190
On Sun, 01 Dec 2019 19:27:21 -0600
Ned Latham <nedlatham@woden.valhalla.oz> wrote:
>But I'll continue with XBNF. If nothing else, it provides the open source
>community with another alternative to the over-complication and versionitis
>of present-day offerings, to the lack of access to machine idiosyncracies,
>and to corporate rapacity.

Newflash - no one cares. As long as the compiler compiles their code and does
a reasonable optimisation job thats all that matters to them. Whether "cc"
calls gcc, clang or something else is irrelevant unless they're trying to use
some bleeding edge features.

[toc] | [prev] | [next] | [standalone]


#70193

FromNed Latham <nedlatham@woden.valhalla.oz>
Date2019-12-02 04:21 -0600
Message-ID<slrnqu9pd8.ko9.nedlatham@woden.valhalla.oz>
In reply to#70192
boltar wrote:
> Ned Latham wrote:
> >
> > But I'll continue with XBNF. If nothing else, it provides the open
> > source community with another alternative to the over-complication
> > and versionitis of present-day offerings, to the lack of access to
> > machine idiosyncracies, and to corporate rapacity.

I should have said "xbnf"; XBNF itself is done, and is and advance in
that area. It will continue regardless.

It's xbnf that will provide the alternative.

> Newflash - no one cares. As long as the compiler compiles their code
> and does a reasonable optimisation job thats all that matters to them.
> Whether "cc" calls gcc, clang or something else is irrelevant unless
> they're trying to use some bleeding edge features.

You're missing the point. Compilers and languages both are becoming
more and more affected by versionitis, and the resultant compatibility
issues. This puts version control in the programmer's hands.

[toc] | [prev] | [next] | [standalone]


#70191

Fromboltar@nowhere.co.uk
Date2019-12-02 08:33 +0000
Message-ID<qs2i80$18h7$1@gioia.aioe.org>
In reply to#70189
On Sun, 1 Dec 2019 18:33:25 +0100
Christian Gollwitzer <auriocus@gmx.de> wrote:
>Am 01.12.19 um 11:56 schrieb Ned Latham:
>> XBNF is no mere scripting language; it is a mathematical meta-language
>> capable of defining the syntax of any 
>
>> context-free grammar: 
>here is your problem: C is not context free. It is usually dealt with 
>the "lexer hack" to use a parser for context-free grammar.
>
>Also, parsing the syntax is only a minor step in most actual compilers. 
>The big pile of work is in the optimizer (which is in theory optional) 
>and the code generator, and another big pile is in the library. Pure C 
>without the library is good for nothing.

Depends if you can embed assembler in it or not. If not its basically useless,
if you can it becomes a posh assembler.

[toc] | [prev] | [next] | [standalone]


#70215

FromMr Flibble <flibbleREMOVETHISBIT@i42.co.uk>
Date2019-12-03 17:05 +0000
Message-ID<2BwFF.20$pj1.9@fx21.dcg>
In reply to#70189
On 01/12/2019 17:33, Christian Gollwitzer wrote:
> Am 01.12.19 um 11:56 schrieb Ned Latham:
>> XBNF is no mere scripting language; it is a mathematical meta-language
>> capable of defining the syntax of any 
> 
>> context-free grammar: 
> here is your problem: C is not context free. It is usually dealt with the "lexer hack" to use a parser for context-free grammar.

neos can compile code for languages which aren't definable using a context free grammar; neos also deals with BOTH the syntax AND the semantics of a language.

> Also, parsing the syntax is only a minor step in most actual compilers. The big pile of work is in the optimizer (which is in theory optional) and the code generator, and another big pile is in the library. Pure C without the library is good for nothing.
> 
> That's why most regulars in this group are rather sceptical of Flibble's project. A more realistic approach would sit on top of LLVM, where years of work have been done already.

Try speaking for yourself and not for others unless you own some kind of fucking crystal ball.

/Flibble

-- 
"Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin

“You won’t burn in hell. But be nice anyway.” – Ricky Gervais

“I see Atheists are fighting and killing each other again, over who doesn’t believe in any God the most. Oh, no..wait.. that never happens.” – Ricky Gervais

"Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say."

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | comp.lang.c++


csiph-web