Date: Sat, 06 Nov 2021 18:58:54 -0700
On Saturday, 6 November 2021 14:31:56 PDT Alejandro Colomar (man-pages) via
Std-Proposals wrote:
> In my experience writing C & C++ compatible headers, the most difficult
> problem which could not be solved by preprocessor macros is this one.
Why not?
#if __STDC_VERSION__ >= 199901L
# define size_at_least(n) static n
# define size_exactly(n) static restrict n
#else
# define size_at_least(n)
# define size_exactly(n)
#endif
void process_array(size_t count, char payload[size_at_least(count)]);
> My proposal is to add VLA syntax to C++, to add compatibility with C
> headers, and also to have the same self-documentation that C prototypes
> already have.
Ok, there's a clear motivation here. Write the paper.
I suspect the C++ side will be "syntax accepted but ignored". Compilers can
choose to print diagnostics if they want to, of course.
Std-Proposals wrote:
> In my experience writing C & C++ compatible headers, the most difficult
> problem which could not be solved by preprocessor macros is this one.
Why not?
#if __STDC_VERSION__ >= 199901L
# define size_at_least(n) static n
# define size_exactly(n) static restrict n
#else
# define size_at_least(n)
# define size_exactly(n)
#endif
void process_array(size_t count, char payload[size_at_least(count)]);
> My proposal is to add VLA syntax to C++, to add compatibility with C
> headers, and also to have the same self-documentation that C prototypes
> already have.
Ok, there's a clear motivation here. Write the paper.
I suspect the C++ side will be "syntax accepted but ignored". Compilers can
choose to print diagnostics if they want to, of course.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DPG Cloud Engineering
Received on 2021-11-06 20:59:00