tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Definitions of types also as macros

we do this in stdint.h and some other headers:

#ifndef uint32_t
typedef __uint32_t      uint32_t;
#define uint32_t        __uint32_t

then, if a package does something like this:

#include <stdint.h>

#define function(name, type) int name##_##type() { return 3; }
#define useless_wrapper(name, type) function(name, type)

useless_wrapper(something, uint32_t)

int main() {
	return something_uint32_t();

It doesn't work, because we define something___uint32_t as a function.

Real-world examples:

And now I ran into:

Proposal: let's not define the macros?
I don't know if there are long running consequences for it.

Home | Main Index | Thread Index | Old Index