[Bugs] [Bug 1596188] XDR files contain illegal "long" integer declarations.

bugzilla at redhat.com bugzilla at redhat.com
Tue Jul 3 13:27:10 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1596188



--- Comment #2 from Sven Anderson <svanders at redhat.com> ---
(In reply to Niels de Vos from comment #1)
> In most occasions an 'unsigned long' should be converted to a u_quad_t in
> the .x file. That matches a uint64_t for the C interface for most common
> architectures.

I did some more research on this. So the XDR specification really only allows
"int" (32 bit) and "hyper" (64 bit) declarations in .x files. "unsigned hyper"
on my machine is converted to "u_quad_t" in the generated .h file, but that
seems to be an internal compatibility type, that is mapped then to the
corresponding platform specific type then. Since "int" in XDR is already 32 bit
(which is the minimum size of a C long), my understanding is to use only "int"
in .x files, if you don't need more than 32 bit.

One might think that rpcgen also accepts u_long or u_quad_t in .x files, but
that is only true in a way that it accepts everything that it doesn't know
about (like foo_bar_t) and just puts it 1:1 into the .h file then. But that I
would regard as a hack, because it makes the RPC definition platform dependent,
which undermines it's original idea.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=H17vzsxHrS&a=cc_unsubscribe


More information about the Bugs mailing list