I've made a program using gcc as a compiler.

In my loops I've been using a uint type as the type of my loop variable.

But now it seems that some systems doesn't support this type.

Can I make a preprocessor conditional that does a

#define uint to unsigned int

if typename uint doesn't exist

thanks in advance

Recommended Answers

All 2 Replies

Don't use macros as types.

typedef unsigned int uint;

I've made a program using gcc as a compiler.

In my loops I've been using a uint type as the type of my loop variable.

But now it seems that some systems doesn't support this type.

Can I make a preprocessor conditional that does a

#define uint to unsigned int

if typename uint doesn't exist

thanks in advance

Why? Use the standard unsigned int rather than a type that doesn't exist in most compilers. You've now seen the reason we try to always recommend not using compiler-specific enhancements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.