tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: major/minor(3) macros conflict with regular code
On Thursday 6 Feb 2025, at 18:01, Greg A. Woods wrote:
> At Thu, 6 Feb 2025 23:48:48 +0100, Anthony Mallet
> <anthony.mallet%laas.fr@localhost> wrote: Subject: major/minor(3) macros
> conflict with regular code
> >
> > Do major(3) and minor(3) really need to be macros?
>
> What do you mean "need to be"?
I meant: they could be static inline functions without breaking
anything, I guess?
> Perhaps your code doesn't need full native NetBSD system
> compatability and so could do without defining _NETBSD_SOURCE --
It's actually sys/featuretest.h that defines _NETBSD_SOURCE under the
hood, not me :)
Indeed, I fixed the build by passing -D_POSIX_C_SOURCE, which should
not hurt in this case.
> Or fix that code to use more descriptive and thus unique names for
> those methods! :-)
Well, the code is just:
message Version
{
int32 major = 1;
int32 minor = 2;
}
Then protobuf generates the C++ code that fails. Seems hard to blame
in this case. For a global symbol, of course 'major' is a really bad
name, but as a method in a class that's more debatable :)
On Friday 7 Feb 2025, at 10:44, Robert Elz wrote:
> Or just
> #undef major
> #undef minor
> between the system #includes and the first mention.
Since it's 100% generated code it's not easy (not possible?) to do
that, in this case
Home |
Main Index |
Thread Index |
Old Index