Re: Static array indices in function parameter declarations
James Prestwood <[email protected]> Tue, 25 Apr 2023 07:49:22 -0700
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
H Brandon, On 4/25/23 2:01 AM, Brandon Cheo Fusi wrote: > Hi everyone, > > I'm currently using ell for talking to dbus, and have found it way > more convenient and easier to use as compared to gdbus, or any of the > other bindings I've looked at. So many thanks. > > The extern "C" usage in the header files show the library is allowed > to be compiled with C++ code. However the usage of the C99 feature > that allows one to declare the index of the argument array using the > 'static' keyword in some header files (like rtnl.h:110) seems to > prevent this. > > Is there a workaround for this issue? Or should I submit a patch that > removes all usage of this feature. Is this you're only issue compiling ELL with C++ code? I ask because I quickly tried: ~/ell$ g++ -o ell/rtnl.o ell/rtnl.c -I. And I got a TON of errors. Mostly void* pointer arithmetic and missing casts from void* to other types. I haven't heard anyone using ELL with C++, maybe a long time ago, so its not surprising there are some problems. If you're willing to fix it I'd say go for it! Specifically, with declaring arrays like this, the compiler can both optimize and warn during compile if your doing something stupid. So you may want to hear back from Marcel/Denis on if we can remove this, or if there is another route to go down. Thanks, James > > Regards, > Brandon. >