Subject: Re: rpcgen fix for -fshort-enums
To: Ben Harris <email@example.com>
From: Todd Vierling <firstname.lastname@example.org>
Date: 02/05/2002 10:16:19
On Tue, 5 Feb 2002, Ben Harris wrote:
"Hey Richard, look, here's yet another prime example of the legacy code that
you don't think exists, which will cause more headaches with -fshort-enums
than the `benefit' is worth!"
[diff to rpcgen]
: + f_print(fout, "\t__rpcgen_%s_min = -0x7fffffff-1,\n", name);
: + f_print(fout, "\t__rpcgen_%s_max = 0x7fffffff,\n", name);
I'm not sure how good these would be as far as portability (and
readability!) is concerned. I'd prefer to see:
f_print(fout, "\t__rpcgen_%s_max = (enum_t)0x7fffffff, /* int32_t */\n", name);
f_print(fout, "\t__rpcgen_%s_min = (-__rpcgen_%s_max)-1,\n", name, name);
This way you're always qualifying it to the type to which you expect a cast.
-- Todd Vierling <email@example.com> * Wasabi & NetBSD: Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/