Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-15 Thread Vincent Lefevre
On 2017-05-12 15:59:44 -0500, Daniel Santos wrote: > [...] But from a conceptual standpoint, I believe the term > "constant-expression" would be incorrect because the C standard > defines this constraint: (6.6.3 of C11) "Constant expressions shall > not contain assignment, increment, decrement,

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Daniel Santos
On 05/12/2017 10:49 AM, Martin Sebor wrote: On 05/10/2017 04:14 PM, Daniel Santos wrote: Well my primary goal is programming with values that are constant in the compiler. There is no language in any C specification (that I'm aware of) for a "compile-time constant", but the concept is very

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Joseph Myers
On Fri, 12 May 2017, Daniel Santos wrote: > > Note that while "other forms" might be accepted in initializers, they > > would still not be integer constant expressions (see DR#312). > > What is DR#312? http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_312.htm (but cf the older

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Daniel Santos
Sorry for my delayed response. On 05/11/2017 09:35 AM, Joseph Myers wrote: On Thu, 11 May 2017, Jonathan Wakely wrote: On 10 May 2017 at 23:14, Daniel Santos wrote: Well my primary goal is programming with values that are constant in the compiler. There is no language in any C specification

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Martin Sebor
On 05/10/2017 04:14 PM, Daniel Santos wrote: On 05/10/2017 04:24 AM, Jonathan Wakely wrote: Just because there's already one way to do something doesn't mean better ways to do it are bad. I'm only speaking out of jealousy being that most of my recent work has been in C. hadn't gone so far

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Joseph Myers
On Thu, 11 May 2017, Jonathan Wakely wrote: > On 10 May 2017 at 23:14, Daniel Santos wrote: > > Well my primary goal is programming with values that are constant in the > > compiler. There is no language in any C specification (that I'm aware of) > > for a "compile-time constant", but the

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Marek Polacek
On Thu, May 11, 2017 at 11:12:24AM +0100, Jonathan Wakely wrote: > On 10 May 2017 at 23:14, Daniel Santos wrote: > > Well my primary goal is programming with values that are constant in the > > compiler. There is no language in any C specification (that I'm aware of) > > for a "compile-time

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Jonathan Wakely
On 10 May 2017 at 23:14, Daniel Santos wrote: > Well my primary goal is programming with values that are constant in the > compiler. There is no language in any C specification (that I'm aware of) > for a "compile-time constant", but the concept is very important. So just > because some

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
On 05/10/2017 04:24 AM, Jonathan Wakely wrote: Just because there's already one way to do something doesn't mean better ways to do it are bad. I'm only speaking out of jealousy being that most of my recent work has been in C. hadn't gone so far as to investigate using this new attribute on

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Jonathan Wakely
On 10 May 2017 at 10:17, Daniel Santos wrote: > Maybe "constexpr" would be a better name, as it mirrors the C++11 keyword. > When I first read about C++ getting constexpr, my first thought was, "Yeah, > as if they needed yet another way to do metaprogramming!" :) However, I Because writing

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
Thanks for your feedback! On 05/09/2017 08:29 AM, Allan Sandfeld Jensen wrote: On Tuesday 09 May 2017, Daniel Santos wrote: The primary aim is to facilitate high-performance generic C libraries for software where C++ is not suitable, but the cost of run-time abstraction is unacceptable. A good

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
Thanks for your feedback! On 05/09/2017 04:36 AM, Florian Weimer wrote: On 05/09/2017 01:36 AM, Daniel Santos wrote: To further the usefulness of such techniques, I propose the addition of a c-family attribute to declare a parameter, variable (and possibly other declarations) as "constprop"

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-09 Thread Allan Sandfeld Jensen
On Tuesday 09 May 2017, Daniel Santos wrote: > The primary aim is to facilitate high-performance generic C > libraries for software where C++ is not suitable, but the cost of > run-time abstraction is unacceptable. A good example is the Linux > kernel, where the source tree is littered with more

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-09 Thread Florian Weimer
On 05/09/2017 01:36 AM, Daniel Santos wrote: To further the usefulness of such techniques, I propose the addition of a c-family attribute to declare a parameter, variable (and possibly other declarations) as "constprop" or some similar word. The purpose of the attribute is to: 1.) Emit a

[RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-08 Thread Daniel Santos
I would like to make some changes in GCC 8, so I thought that formal proposal and RFC would be the best path. I'm still relatively new to the GCC project. I began experimenting with C metaprogramming techniques back in 2012, in order to implement more efficient generic libraries in C. The