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, fun

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 impo

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 http://www.open

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 as

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 concept

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 consta

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 expressio

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 functi

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" or

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 th

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 warn

[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

Re: C Metaprogramming

2012-06-20 Thread Richard Guenther
On Wed, Jun 20, 2012 at 8:21 AM, Daniel Santos wrote: > Thanks for your response! > > On 06/19/2012 08:40 AM, Richard Guenther wrote: >> On Tue, Jun 19, 2012 at 4:41 AM, Daniel Santos wrote: >>> So before filing any feature request bugs, I figured I should bring my >>> discussion here first, as I

Re: C Metaprogramming

2012-06-19 Thread Daniel Santos
Thanks for your response! On 06/19/2012 08:40 AM, Richard Guenther wrote: > On Tue, Jun 19, 2012 at 4:41 AM, Daniel Santos wrote: >> So before filing any feature request bugs, I figured I should bring my >> discussion here first, as I believe some enhancements to gcc can better >> enable this typ

Re: C Metaprogramming

2012-06-19 Thread Richard Guenther
On Tue, Jun 19, 2012 at 4:41 AM, Daniel Santos wrote: > Yes, my topic sounds crazy huh?  But you guys made it possible when you > started optimizing out constant function pointers. (Thank you!!) This > didn't mature to "full power" until 4.6.? (works in 4.6.2, not sure > about earlier 4.6).  Now t

Re: C Metaprogramming

2012-06-19 Thread Mike Dupont
Thats very interesting, thanks for sharing. mike On Tue, Jun 19, 2012 at 4:41 AM, Daniel Santos wrote: > Yes, my topic sounds crazy huh?  But you guys made it possible when you > started optimizing out constant function pointers. (Thank you!!) This > didn't mature to "full power" until 4.6.? (wor

C Metaprogramming

2012-06-18 Thread Daniel Santos
Yes, my topic sounds crazy huh? But you guys made it possible when you started optimizing out constant function pointers. (Thank you!!) This didn't mature to "full power" until 4.6.? (works in 4.6.2, not sure about earlier 4.6). Now that you can populate a struct with const pointers to inline fun