Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 10:56 Uhr schrieb Florian Weimer : > This is the case that is unclear: > > double x[2]; > double *p = &x[1]; > > The standard explicitly says “first element of an array”. That's fine as well, I think. "x + 1" just points to an array of length 1 in memory.

Re: Module with preprocessor utilities

2020-07-24 Thread Florian Weimer
* Marc Nieper-Wißkirchen: > Am Fr., 24. Juli 2020 um 10:05 Uhr schrieb Florian Weimer > : > >> It's still a candidate for an RFE. Martin Sebor has been working on >> such warnings. I'm going to talk to him. > > It may also be useful for optimizations because the compiler may make > assumptions.

Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 10:05 Uhr schrieb Florian Weimer : > It's still a candidate for an RFE. Martin Sebor has been working on > such warnings. I'm going to talk to him. It may also be useful for optimizations because the compiler may make assumptions. > >> It's also undefined when you pass

Re: Module with preprocessor utilities

2020-07-24 Thread Florian Weimer
* Marc Nieper-Wißkirchen: > Am Fr., 24. Juli 2020 um 08:53 Uhr schrieb Florian Weimer > : > >> * Bruno Haible: > >> > (This is with gcc 10.1.0.) >> > >> > clang, OTOH, produces warnings for both foo1 and foo2. >> > >> > But I won't spend time to report a GCC bug on this, because - as you said - >

Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 08:53 Uhr schrieb Florian Weimer : > * Bruno Haible: > > (This is with gcc 10.1.0.) > > > > clang, OTOH, produces warnings for both foo1 and foo2. > > > > But I won't spend time to report a GCC bug on this, because - as you said - > > without the ability to declare a poin

Re: Module with preprocessor utilities

2020-07-23 Thread Florian Weimer
* Bruno Haible: > Also, if that's the intent of the syntax, it has been overlooked by the > GCC developers. See: > > decl.c > #include > > extern void foo1 (double x [static 1]); > extern void foo2 (double x []) __attribute__ ((__nonnull__

Re: Module with preprocessor utilities

2020-07-23 Thread Bruno Haible
[Adding back bug-gnulib in CC] Marc Nieper-Wißkirchen wrote: > > Marc Nieper-Wißkirchen wrote: > > > For example, do we want to encourage the writing of > > > sophisticated macros like the TRACE macros in chapter 16 of (the IMHO > > > opinionated) book Modern C ([1]). > > > > This TRACE macro is a

Re: Module with preprocessor utilities

2020-07-20 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > For example, do we want to encourage the writing of > sophisticated macros like the TRACE macros in chapter 16 of (the IMHO > opinionated) book Modern C ([1]). This TRACE macro is an interesting academic example. I say "academic", because who wants a trace statement

Re: Module with preprocessor utilities

2020-07-20 Thread Marc Nieper-Wißkirchen
> If you know of shortcomings of _GL_CONCAT, we need to determine whether we > should just document a limitation, or spend the necessary macro complexity > in order to fix it. Sorry for the misunderstanding; _GL_CONCAT is fine because it takes a detour over _GL_CONCAT0. But not every macro-writing

Re: Module with preprocessor utilities

2020-07-20 Thread Marc Nieper-Wißkirchen
Thank you for your input. So I won't come up with a full-featured (meta-programming) macro module but may propose one or the other small module about macros that I have found useful (and fool-proof) in my own code. The amount of macro one needs depends on the programming style, of course. For exam

Re: Module with preprocessor utilities

2020-07-20 Thread Paul Eggert
I'm a bit leery of this idea, as it is painful to write and debug reliable preprocessor macros. When you need macros you really need them, but they're best avoided in the first place. The fanciest macros I've contributed to Gnulib are in ; they had to be macros because C won't let you write po

Re: Module with preprocessor utilities

2020-07-20 Thread Bruno Haible
Hi Marc, > I was thinking of macros like P99_NARG or P99_FOR, which are > non-trivial to write but can be very helpful to write practical user > macros (e.g. macros with default arguments). In order to avoid bloat, I would suggest to start with a particular problem (e.g. macros with default argum

Re: Module with preprocessor utilities

2020-07-20 Thread Marc Nieper-Wißkirchen
Dear Bruno, thank you very much for your detailed answer. Am So., 19. Juli 2020 um 17:43 Uhr schrieb Bruno Haible : > > What would be the chances to include a module with sophisticated > > preprocessor macros like P99 ([1]) or the Boost Preprocessing library > > ([2])? I realize that I wasn't v

Re: Module with preprocessor utilities

2020-07-19 Thread Bruno Haible
Hi Marc, > Besides modules to improve system compatibility, Gnulib contains a > number of modules that provide "missing" functionality of the C > standard library (like the gl_list module). > > What would be the chances to include a module with sophisticated > preprocessor macros like P99 ([1]) o

Module with preprocessor utilities

2020-07-19 Thread Marc Nieper-Wißkirchen
Besides modules to improve system compatibility, Gnulib contains a number of modules that provide "missing" functionality of the C standard library (like the gl_list module). What would be the chances to include a module with sophisticated preprocessor macros like P99 ([1]) or the Boost Preprocess