Project-wide redefinition of builtin types

Hello,

I'm writing a library that needs a lot of fixed length integer values such as uint32_t and uint64_t defined as standard in the cstdint header.

For convinience I wanted to write a redefinition header "commons.h" that redefines unsigend int and unsigned long to this types and include this header in all headers.

Drawback: I force the user of my lib to live with this redefinitions when including one of the lib's headers.

What do you think of that approch? Is there a way to elimitnate the drawback while still getting to use the redefined builtins?

Thanks!
closed account (o3hC5Di1)
Hi there,

You may want to consider moving this question to the "general c++ programming" forum.
I'm sure somebody will be happy to help you there.

All the best,
NwN
Why not just use the fixed length integer types directly? Is there some reason you absolutely have to use "unsigned int" to mean, say, "uint32_t" instead of simply using "uint32_t"?

If you must, you should put your library code in namespaces so when you do typedefs like that they will be local to your library namespace.
Topic archived. No new replies allowed.