[Issue 23441] importc: array length macro preprocessed with cpp doesn't compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 19 03:18:53 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23441
Walter Bright <bugzilla at digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla at digitalmars.com
--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to kinke from comment #2)
> That NK_LEN macro apparently makes use of a weird special syntax to get the
> length of a C array, see the last 'notes' paragraph in
> https://en.cppreference.com/w/c/language/sizeof.
The cite says:
"Number of elements in any array a including VLA (since C99) may be determined
with the expression sizeof a / sizeof a[0]. Note that if a has pointer type
(such as after array-to-pointer conversion of function parameter type
adjustment), this expression would simply divide the number of bytes in a
pointer type by the number of bytes in the pointed type."
--
More information about the Digitalmars-d-bugs
mailing list