[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:25:05 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23441

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #6 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to ryuukk_ from comment #0)
>     // #define NK_LEN(a) (sizeof(a)/sizeof(a)[0])

The usual way this is written:

    #define NK_LEN(a) (sizeof(a)/sizeof((a)[0]))

But in order to work, `a` must be a static array. nk_utfmask is a struct. It
will also fail because in C, it would have to be `struct nk_utfmask`, not just
`nk_utfmask`.

I'm going to mark this as invalid.

--


More information about the Digitalmars-d-bugs mailing list