Mailing List Archive

Developers: How to get around system's typedef's?
Dear developers,

I encountered a hairy problem with the module I recently released:

On some systems, there are header-files which predefine certain types
with "typedef", for instance "uint", "u_int" and "unint" (with analogues
for other scalar types) for the "unsigned" version of that type.

Is there another way around this problem (which leads to compiler warnings
or even fatal compiler errors on some systems) than choosing names as
unusual as possible (maybe "grglblrgh" would be best! ;-) )?

The module is rather small, so I think a "Configure" script would be sort
of an overkill (it would probably be larger than the module itself!).

Any help greatly appreciated!!!

Thanks a lot in advance!

Yours sincerely,
--
Steffen Beyer
mailto:sb@sdm.de |s |d &|m | software design & management GmbH&Co.KG
phone: +49 89 63812-244 | | | | Thomas-Dehler-Str. 27
fax: +49 89 63812-150 | | | | 81737 Munich, Germany.
Re: Developers: How to get around system's typedef's? [ In reply to ]
On 21 Nov 1995, Steffen Beyer wrote:

> Dear developers,
>
> I encountered a hairy problem with the module I recently released:
>
> On some systems, there are header-files which predefine certain types
> with "typedef", for instance "uint", "u_int" and "unint" (with analogues
> for other scalar types) for the "unsigned" version of that type.
>
> Is there another way around this problem (which leads to compiler warnings
> or even fatal compiler errors on some systems) than choosing names as
> unusual as possible (maybe "grglblrgh" would be best! ;-) )?

There's no substitute for experience here, I'm afraid. Having run into
the uint vs. u_int stuff many times, I tend to avoid either one -- if
I'm awake when I write the program.

Fortunately, perl represents one of the largest sources of net experience
you'll find, and many of these problems are solved for you in the perl
source. You may safely use U32 as an unsigned integral quantity that
is at least 32 bits and almost always an unsigned int. Lots of other
goodies are defined in config.h.

Since your module already #includes "perl.h", you get all this work for
free, so you might as well use it.

Andy Dougherty doughera@lafcol.lafayette.edu