Re: Wish: scoped enum

2023-05-12 Thread Yair Lenga via Gcc
ed backends, optimizer, code generation - so that change should be (in theory) only in the "C" front end. Once there is implementation - where should it get posted for feedback/review ? Thanks again for the useful feedback. Yair On Thu, May 11, 2023 at 8:15 PM Gabriel Ravier wrote:

Re: Wish: scoped enum

2023-05-12 Thread Yair Lenga via Gcc
- shared backends, optimizer, code generation - so that change should be (in theory) only in the "C" front end. Thanks again for the useful feedback. Yair On Thu, May 11, 2023 at 8:15 PM Gabriel Ravier wrote: > On 5/12/23 01:58, Yair Lenga via Gcc wrote: > > Hi, > > >

Wish: scoped enum

2023-05-11 Thread Yair Lenga via Gcc
Hi, I wonder if it will be possible to add support for "scoped" enum to GCC. The current C standard has one name space for all enums, and different name space for the members of each "struct". As a result, possible to say struct foo { int a } ; struct bar { double a }; // This is different 'a

C pre-processor: Better grammar for multi-line macros

2022-07-26 Thread Yair Lenga via Gcc
Hi, I'm trying to get community feedback for a proposal to enhance the C preprocessor support for multi-line macros. For this discussion, I prefer to put aside the philosophical debate about using macro vs generics - I'm assuming preprocessor macros are a valid solution to implement generic logic

Re: Gcc Digest, Vol 29, Issue 7

2022-07-06 Thread Yair Lenga via Gcc
Thanks for suggestion, definitely doable, more verbose vs the scanf, but will do the trick. I will use it as my fallback, if no path with my current approach. Yair. Sent from my iPad > On Jul 6, 2022, at 10:17 AM, David Brown wrote: > > I haven't worked through all the details, but I wonder if

Re: Gcc Digest, Vol 29, Issue 7

2022-07-05 Thread Yair Lenga via Gcc
mer wrote: > > * Yair Lenga via Gcc: > >> My question: does anyone know how much effort it will be to add a new GCC >> built-in (or extension), that will automatically generate a descriptive >> format string, consistent with scanf formatting, avoiding the need to &g

Re: Gcc Digest, Vol 29, Issue 7

2022-07-05 Thread Yair Lenga via Gcc
Hi, Wanted to get some feedback on an idea that I have - trying to address the age long issue with type check on VA list function - like 'scanf' and friends. In my specific case, I'm trying to build code that will parse a list of values from SELECT statement into list of C variables. The type of t

Re: Safer vararg calls

2022-06-25 Thread Yair Lenga via Gcc
AM Jonathan Wakely wrote: > On Tue, 21 Jun 2022 at 11:17, Yair Lenga via Gcc wrote: > > > > Hi, > > > > Looking for feedback on the adding new attribute to function calls that > will help create safer vararg functions. > > > > Consider the case where a var

Safer vararg calls

2022-06-21 Thread Yair Lenga via Gcc
Hi, Looking for feedback on the adding new attribute to function calls that will help create safer vararg functions. Consider the case where a vararg function takes list of arguments of the same type. In my case, there are terminated with a sentinel of null. Char *result = delimitedstr(‘:’ “fo

[RFC] Support for nonzero attribute (Miika)

2022-06-08 Thread Yair Lenga via Gcc
Miika - lot of thanks. In .y mind, this is a major improvement. Also, want to suggest taking a nother look into the semnatic. I agreed inrange should include the low and high, similar to the gcc extensions) .. operator, the SQL in operator, perl .. operator, etc. There is another use common use c

Re: [RFC] Support for nonzero attribute

2022-06-04 Thread Yair Lenga via Gcc
Static checks will be a good starting point! On Sat, Jun 4, 2022 at 7:55 AM Miika wrote: > On Saturday, June 4th, 2022 at 1:26 PM, Yair Lenga via Gcc < > gcc@gcc.gnu.org> wrote: > > The specific non-zero constraint is a specific implementation of the > range > > op

[RFC] Support for nonzero attribute

2022-06-04 Thread Yair Lenga via Gcc
Before becoming a "C" programmer, I spent few years building simulations in Pascal. I still remember (and long for) the ability to define integer with range constraints: var foobar: 10..50 ; // Accept 10, 11, 12, ..., 49, 50 The specific non-zero constraint is a specific implementation of

Passing c blocks to pre processor

2022-05-27 Thread Yair Lenga via Gcc
Hi, I am trying to define macros that will accept code blocks. This will be used to create high level structures (like iterations, etc.). Ideally, I would like to do something like (this is simplified example, actual code much more application specific): Foreach(var, low, high, block) While s